[Fusionforge-commits] r11778 - in trunk/src: common/forum common/include/system common/pm common/survey www/admin

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sun Dec 12 13:53:14 CET 2010


Author: nerville
Date: 2010-12-12 13:53:14 +0100 (Sun, 12 Dec 2010)
New Revision: 11778

Modified:
   trunk/src/common/forum/Forum.class.php
   trunk/src/common/include/system/pgsql.class.php
   trunk/src/common/pm/ProjectGroup.class.php
   trunk/src/common/survey/Survey.class.php
   trunk/src/common/survey/SurveyFactory.class.php
   trunk/src/common/survey/SurveyQuestion.class.php
   trunk/src/www/admin/groupdelete.php
Log:
indent and comment

Modified: trunk/src/common/forum/Forum.class.php
===================================================================
--- trunk/src/common/forum/Forum.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/forum/Forum.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -198,15 +198,15 @@
 
 		db_begin();
 		$result = db_query_params('INSERT INTO forum_group_list (group_id,forum_name,is_public,description,send_all_posts_to,allow_anonymous,moderation_level) VALUES ($1,$2,$3,$4,$5,$6,$7)',
-					  array ($this->Group->getID(),
-						 strtolower($forum_name),
-						 $is_public,
-						 htmlspecialchars($description),
-						 $send_all_posts_to,
-						 $allow_anonymous,
-						 $moderation_level));
+					  array($this->Group->getID(),
+						strtolower($forum_name),
+						$is_public,
+						htmlspecialchars($description),
+						$send_all_posts_to,
+						$allow_anonymous,
+						$moderation_level));
 		if (!$result) {
-			$this->setError(_('Error Adding Forum').db_error());
+			$this->setError(_('Error Adding Forum:').' '.db_error());
 			db_rollback();
 			return false;
 		}
@@ -249,27 +249,27 @@
 	}
 
 	/**
-	 *	getGroup - get the Group object this ArtifactType is associated with.
+	 * getGroup - get the Group object this ArtifactType is associated with.
 	 *
-	 *	@return	object	The Group object.
+	 * @return	object	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
 	}
 
 	/**
-	 *	getID - The id of this forum.
+	 * getID - The id of this forum.
 	 *
-	 *	@return	int	The group_forum_id #.
+	 * @return	int	The group_forum_id #.
 	 */
 	function getID() {
 		return $this->data_array['group_forum_id'];
 	}
 
 	/**
-	 *	getNextThreadID - The next thread_id for a new top in this forum.
+	 * getNextThreadID - The next thread_id for a new top in this forum.
 	 *
-	 *	@return	int	The next thread_id #.
+	 * @return	int	The next thread_id #.
 	 */
 	function getNextThreadID() {
 		$result = db_query_params('SELECT nextval($1)',

Modified: trunk/src/common/include/system/pgsql.class.php
===================================================================
--- trunk/src/common/include/system/pgsql.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/include/system/pgsql.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -33,26 +33,26 @@
 	/**
  	* Value to add to unix_uid to get unix uid
  	* 
- 	* @var	constant		$UID_ADD
+ 	* @var	constant	$UID_ADD
  	*/
 	var $UID_ADD = 20000;
 		
 	/**
  	* Value to add to group_id to get unix gid
  	*
- 	* @var	constant		$GID_ADD
+ 	* @var	constant	$GID_ADD
  	*/
 	var $GID_ADD = 10000;
 		
 	/**
  	* Value to add to unix gid to get unix uid of anoncvs special user
  	*
- 	* @var	constant		$SCM_UID_ADD
+ 	* @var	constant	$SCM_UID_ADD
  	*/
 	var $SCM_UID_ADD = 50000;
 
 	/**
-	*	pgsql() - CONSTRUCTOR
+	* pgsql() - CONSTRUCTOR
 	*
 	*/
 	function pgsql() {
@@ -63,15 +63,14 @@
 	/**
 	* sysUseUnixName() - Check if user/group used the unix_name
 	*
-	* @param		string   The unix_name to check
-	* @returns true if used/false is free
-	*
+	* @param	string	The unix_name to check
+	* @return	boolean	true if used/false is free
 	*/
 	function sysUseUnixName($unix_name) {
-		$res1 = db_query_params ('SELECT user_id FROM users
-		                          WHERE user_name=$1',array($unix_name));
-		$res2 = db_query_params ('SELECT group_id FROM groups
-		                          WHERE unix_group_name=$1',array($unix_name));
+		$res1 = db_query_params('SELECT user_id FROM users
+		                         WHERE user_name=$1',array($unix_name));
+		$res2 = db_query_params('SELECT group_id FROM groups
+		                         WHERE unix_group_name=$1',array($unix_name));
 		if ( db_numrows($res1) == 0 && db_numrows($res2) == 0 ){
 			return true;
 		}
@@ -85,8 +84,8 @@
 	/**
  	* sysCheckUser() - Check for the existence of a user
  	* 
- 	* @param		int		The user ID of the user to check
- 	* @returns true on success/false on error
+ 	* @param	int	The user ID of the user to check
+ 	* @return	boolean	true on success/false on error
  	*
  	*/
 	function sysCheckUser($user_id) {
@@ -100,8 +99,8 @@
 	/**
  	* sysCreateUser() - Create a user
  	*
- 	* @param		int	The user ID of the user to create
- 	* @returns The return status
+ 	* @param	int	The user ID of the user to create
+ 	* @return	boolean	success or not
  	*
  	*/
 	function sysCreateUser($user_id) {
@@ -167,8 +166,8 @@
 	/**
  	* sysCheckCreateUser() - Check that a user has been created
  	*
- 	* @param		int		The ID of the user to check
- 	* @returns true on success/false on error
+ 	* @param	int	The ID of the user to check
+ 	* @return	boolean	true on success/false on error
  	*
  	*/
 	function sysCheckCreateUser($user_id) {
@@ -178,8 +177,8 @@
 	/**
  	* sysCheckCreateGroup() - Check that a group has been created
  	*
- 	* @param		int		The ID of the user to check
- 	* @returns true on success/false on error
+ 	* @param	int	The ID of the user to check
+ 	* @return	boolean	true on success/false on error
  	*
  	*/
 	function sysCheckCreateGroup($user_id) {
@@ -189,14 +188,14 @@
 	/**
  	* sysRemoveUser() - Remove a user
  	*
- 	* @param		int		The user ID of the user to remove
- 	* @returns true on success/false on failure
+ 	* @param	int	The user ID of the user to remove
+ 	* @return	boolean	true on success/false on failure
  	*
  	*/
 	function sysRemoveUser($user_id) {
-		$res = db_query_params ('UPDATE users SET unix_status=$1 WHERE user_id=$2',
+		$res = db_query_params('UPDATE users SET unix_status=$1 WHERE user_id=$2',
 					array ('N',
-					       $user_id)) ;
+					       $user_id));
 		if (!$res) {
 			$this->setError('ERROR - Could Not Update User Unix Status: '.db_error());
 			return false;
@@ -222,10 +221,10 @@
 	/**
  	* sysUserSetAttribute() - Set an attribute for a user
  	*
- 	* @param		int		The user ID 
- 	* @param		string	The attribute to set
- 	* @param		string	The new value of the attribute
- 	* @returns true on success/false on error
+ 	* @param	int	The user ID 
+ 	* @param	string	The attribute to set
+ 	* @param	string	The new value of the attribute
+ 	* @return	boolean	true on success/false on error
  	*
  	*/
 	function sysUserSetAttribute($user_id,$attr,$value) {
@@ -239,8 +238,8 @@
 	/**
  	* sysCheckGroup() - Check for the existence of a group
  	* 
- 	* @param		int		The ID of the group to check
- 	* @returns true on success/false on error
+ 	* @param	int	The ID of the group to check
+ 	* @return	boolean	true on success/false on error
  	*
  	*/
 	function sysCheckGroup($group_id) {
@@ -248,8 +247,8 @@
 		if (!$group){
 			return false;
 		} else {
-			$res = db_query_params ('SELECT group_id FROM nss_groups WHERE group_id=$1',
-						array ($group_id));
+			$res = db_query_params('SELECT group_id FROM nss_groups WHERE group_id=$1',
+						array($group_id));
 			if (db_numrows($res) == 0){
 				return false;
 			} else {
@@ -341,11 +340,10 @@
  	/**
 	 * sysGroupAddUser() - Add a user to a group
 	 *
-	 * @param		int		The ID of the group two which the user will be added
-	 * @param		int		The ID of the user to add
-	 * @param		bool	ignored
-	 * @returns true on success/false on error
-	 *
+	 * @param	int	The ID of the group two which the user will be added
+	 * @param	int	The ID of the user to add
+	 * @param	bool	ignored
+	 * @return	boolean	true on success/false on error
 	 */
 	function sysGroupAddUser($group_id,$user_id,$foo=NULL) {
 		return $this->sysGroupCheckUser($group_id,$user_id) ;
@@ -354,10 +352,9 @@
 	/**
  	* sysGroupCheckUser() - Sync user's Unix permissions with their FF permissions within a group
  	*
- 	* @param		int		The ID of the group
- 	* @param		int		The ID of the user
- 	* @returns true on success/false on error
- 	*
+ 	* @param	int	The ID of the group
+ 	* @param	int	The ID of the user
+ 	* @return	boolean	true on success/false on error
  	*/
 	function sysGroupCheckUser($group_id,$user_id) {
 		db_begin () ;
@@ -365,7 +362,7 @@
 			db_rollback () ;
 			return false;
 		}
-		
+
 		$u = user_get_object($user_id) ;
 		$p = group_get_object($group_id) ;
 		if (forge_check_perm_for_user($u,'scm',$group_id,'write')) {
@@ -382,18 +379,18 @@
   AND users.unix_status=$5
   AND groups.status=$6
   AND groups.group_id=$7)',
-						array ($this->SCM_UID_ADD,
-						       'scm_',
-						       $user_id,
-						       'A', 'A', 'A',
-						       $group_id)) ;
+						array($this->SCM_UID_ADD,
+						      'scm_',
+						      $user_id,
+						      'A', 'A', 'A',
+						      $group_id));
 			if (!$res) {
-				db_rollback () ;
+				db_rollback();
 				$this->setError('ERROR - Could Not Update Group Member(s): '.db_error());
 				return false;
 			}
 		}
-		
+
 		if ($u->isMember($p)) {
 			$res = db_query_params ('INSERT INTO nss_usergroups (
 SELECT users.unix_uid AS uid,
@@ -426,10 +423,9 @@
 	/**
  	* sysGroupRemoveUser() - Remove a user from a group
  	*
- 	* @param		int		The ID of the group from which to remove the user
- 	* @param		int		The ID of the user to remove
- 	* @returns true on success/false on error
- 	*
+ 	* @param	int	The ID of the group from which to remove the user
+ 	* @param	int	The ID of the user to remove
+ 	* @return	boolean	true on success/false on error
  	*/
 	function sysGroupRemoveUser($group_id,$user_id) {
 		$res = db_query_params ('DELETE FROM nss_usergroups WHERE user_id=$1 AND group_id=$2',

Modified: trunk/src/common/pm/ProjectGroup.class.php
===================================================================
--- trunk/src/common/pm/ProjectGroup.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/pm/ProjectGroup.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -27,20 +27,20 @@
 require_once $gfcommon.'include/Error.class.php';
 
 	/**
-	*	Fetches a ProjectGroup object from the database
+	* Fetches a ProjectGroup object from the database
 	*
-	* @param group_project_id	the projectgroup id  
-	*	@param data	whether or not the db result handle is passed in
-	*	@return	the ProjectGroup object
+	* @param	int	the projectgroup id  
+	* @param	array	whether or not the db result handle is passed in
+	* @return	object	the ProjectGroup object
 	*/
-	function &projectgroup_get_object($group_project_id,$data=false) {
+	function &projectgroup_get_object($group_project_id, $data = false) {
 		global $PROJECTGROUP_OBJ;
 		if (!isset($PROJECTGROUP_OBJ["_".$group_project_id."_"])) {
 			if ($data) {
 				//the db result handle was passed in
 			} else {
-				$res = db_query_params ('SELECT * FROM project_group_list_vw WHERE group_project_id=$1',
-							array ($group_project_id)) ;
+				$res = db_query_params('SELECT * FROM project_group_list_vw WHERE group_project_id=$1',
+							array($group_project_id));
 				if (db_numrows($res) <1 ) {
 					$PROJECTGROUP_OBJ["_".$group_project_id."_"]=false;
 					return false;
@@ -53,19 +53,19 @@
 		return $PROJECTGROUP_OBJ["_".$group_project_id."_"];
 	}
 
-function projectgroup_get_groupid ($group_project_id) {
+function projectgroup_get_groupid($group_project_id) {
 	global $PROJECTGROUP_OBJ;
 	if (isset($PROJECTGROUP_OBJ["_".$group_project_id."_"])) {
 		return $PROJECTGROUP_OBJ["_".$group_project_id."_"]->Group->getID() ;
 	}
 
-	$res = db_query_params ('SELECT group_id FROM project_group_list WHERE group_project_id=$1',
-				array ($group_project_id)) ;
+	$res = db_query_params('SELECT group_id FROM project_group_list WHERE group_project_id=$1',
+				array($group_project_id));
 	if (!$res || db_numrows($res) < 1) {
 		return false;
 	}
-	$arr = db_fetch_array ($res);
-	return $arr['group_id'] ;
+	$arr = db_fetch_array($res);
+	return $arr['group_id'];
 }
 
 class ProjectGroup extends Error {
@@ -73,14 +73,14 @@
 	/**
 	 * Associative array of data from db.
 	 *
-	 * @var	 array   $data_array.
+	 * @var	array	$data_array.
 	 */
 	var $data_array;
 
 	/**
 	 * The Group object.
 	 *
-	 * @var	 object  $Group.
+	 * @var	object	$Group.
 	 */
 	var $Group;
 	var $statuses;
@@ -88,14 +88,14 @@
 	var $technicians;
 
 	/**
-	 *  Constructor.
+	 * Constructor.
 	 *
-	 *	@param	object	The Group object to which this forum is associated.
-	 *  @param  int	 The group_project_id.
-	 *  @param  array	The associative array of data.
-	 *	@return	boolean	success.
+	 * @param	object	The Group object to which this forum is associated.
+	 * @param	int	The group_project_id.
+	 * @param	array	The associative array of data.
+	 * @return	boolean	success.
 	 */
-	function ProjectGroup(&$Group, $group_project_id=false, $arr=false) {
+	function ProjectGroup(&$Group, $group_project_id = false, $arr = false) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
 			$this->setError('ProjectGroup:: No Valid Group Object');
@@ -132,13 +132,13 @@
 	}
 
 	/**
-	 *	create - create a new ProjectGroup in the database.
+	 * create - create a new ProjectGroup in the database.
 	 *
-	 *	@param	string	The project name.
-	 *	@param	string	The project description.
-	 *	@param	int	Whether it is (1) public or (0) private .
-	 *	@param	string	The email address to send new notifications to.
-	 *	@return boolean success.
+	 * @param	string	The project name.
+	 * @param	string	The project description.
+	 * @param	int	Whether it is (1) public or (0) private .
+	 * @param	string	The email address to send new notifications to.
+	 * @return	boolean	success.
 	 */
 	function create($project_name,$description,$is_public=1,$send_all_posts_to='') {
 		if (strlen($project_name) < 3) {
@@ -163,12 +163,12 @@
 		}
 
 		db_begin();
-		$result = db_query_params ('INSERT INTO project_group_list (group_id,project_name,is_public,description,send_all_posts_to) VALUES ($1,$2,$3,$4,$5)',
-					   array ($this->Group->getId(),
-						  htmlspecialchars($project_name),
-						  $is_public,
-						  htmlspecialchars($description),
-						  $send_all_posts_to)) ;
+		$result = db_query_params('INSERT INTO project_group_list (group_id,project_name,is_public,description,send_all_posts_to) VALUES ($1,$2,$3,$4,$5)',
+					  array($this->Group->getId(),
+						htmlspecialchars($project_name),
+						$is_public,
+						htmlspecialchars($description),
+						$send_all_posts_to));
 		if (!$result) {
 			$this->setError('Error Adding ProjectGroup: '.db_error());
 			db_rollback();
@@ -183,10 +183,10 @@
 	}
 
 	/**
-	 *  fetchData - re-fetch the data for this ProjectGroup from the database.
+	 * fetchData - re-fetch the data for this ProjectGroup from the database.
 	 *
-	 *  @param  int	 The project group ID.
-	 *  @return	boolean	success.
+	 * @param	int	The project group ID.
+	 * @return	boolean	success.
 	 */
 	function fetchData($group_project_id) {
 		$res = db_query_params ('SELECT * FROM project_group_list_vw WHERE group_project_id=$1 AND group_id=$2',
@@ -202,72 +202,72 @@
 	}
 
 	/**
-	 *	getGroup - get the Group object this ProjectGroup is associated with.
+	 * getGroup - get the Group object this ProjectGroup is associated with.
 	 *
-	 *	@return	object	The Group object.
+	 * @return	object	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
 	}
 
 	/**
-	 *	getID - get this GroupProjectID.
+	 * getID - get this GroupProjectID.
 	 *
-	 *	@return	int	The group_project_id #.
+	 * @return	int	The group_project_id #.
 	 */
 	function getID() {
 		return $this->data_array['group_project_id'];
 	}
 
 	/**
-	 *	getOpenCount - get the count of open tracker items in this tracker type.
+	 * getOpenCount - get the count of open tracker items in this tracker type.
 	 *
-	 *	@return   int The count.
+	 * @return	int	The count.
 	 */
 	function getOpenCount() {
 		return $this->data_array['open_count'];
 	}
 
 	/**
-	 *	getTotalCount - get the total number of tracker items in this tracker type.
+	 * getTotalCount - get the total number of tracker items in this tracker type.
 	 *
-	 *	@return   int The total count.
+	 * @return	int	The total count.
 	 */
 	function getTotalCount() {
 		return $this->data_array['count'];
 	}
 
 	/**
-	 *	isPublic - Is this projectGroup open to the general public.
+	 * isPublic - Is this projectGroup open to the general public.
 	 *
-	 *	@return boolean	allow.
+	 * @return	boolean	allow.
 	 */
 	function isPublic() {
 		return $this->data_array['is_public'];
 	}
 
 	/**
-	 *	getName - get the name of this projectGroup.
+	 * getName - get the name of this projectGroup.
 	 *
-	 *	@return string	The name of this projectGroup.
+	 * @return	string	The name of this projectGroup.
 	 */
 	function getName() {
 		return $this->data_array['project_name'];
 	}
 
 	/**
-	 *	getSendAllPostsTo - an optional email address to send all task updates to.
+	 * getSendAllPostsTo - an optional email address to send all task updates to.
 	 *
-	 *	@return string	The email address.
+	 * @return	string	The email address.
 	 */
 	function getSendAllPostsTo() {
 		return $this->data_array['send_all_posts_to'];
 	}
 
 	/**
-	 *	getDescription - the description of this ProjectGroup.
+	 * getDescription - the description of this ProjectGroup.
 	 *
-	 *	@return string	The description.
+	 * @return	string	The description.
 	 */
 	function getDescription() {
 		return $this->data_array['description'];
@@ -276,12 +276,12 @@
 	/**
 	 * getStatuses - Return result set of statuses.
 	 *
-	 * @returns Database result set.
+	 * @return	object	Database result set.
 	 */
-	function getStatuses () {
+	function getStatuses() {
 		if (!$this->statuses) {
-			$this->statuses = db_query_params ('SELECT * FROM project_status',
-							   array());
+			$this->statuses = db_query_params('SELECT * FROM project_status',
+							  array());
 		}
 		return $this->statuses;
 	}
@@ -289,20 +289,20 @@
 	/**
 	 * getCategories - Return result set of categories.
 	 *
-	 * @returns Database result set.
+	 * @return	object	Database result set.
 	 */
 	function getCategories () {
 		if (!$this->categories) {
-			$this->categories = db_query_params ('SELECT category_id,category_name FROM project_category WHERE group_project_id=$1',
-							     array ($this->getID()));
+			$this->categories = db_query_params('SELECT category_id,category_name FROM project_category WHERE group_project_id=$1',
+							    array($this->getID()));
 		}
 		return $this->categories;
 	}
 
 	/**
-	 *  getCategoryObjects - Array of ProjectCategory objects set up for this artifact type.
+	 * getCategoryObjects - Array of ProjectCategory objects set up for this artifact type.
 	 *
-	 *  @return array   Of ProjectCategory objects.
+	 * @return	array	Of ProjectCategory objects.
 	 */
 	function &getCategoryObjects() {
 		$res = $this->getCategories();
@@ -314,14 +314,14 @@
 	}
 
 	/**
-	 *	update - update a ProjectGroup in the database.
+	 * update - update a ProjectGroup in the database.
 	 *
-	 *	@param	string	The project name.
-	 *	@param	string	The project description.
-	 *	@param	string	The email address to send new notifications to.
-	 *	@return boolean success.
+	 * @param	string	The project name.
+	 * @param	string	The project description.
+	 * @param	string	The email address to send new notifications to.
+	 * @return	boolean	success.
 	 */
-	function update($project_name,$description,$send_all_posts_to='') {
+	function update($project_name, $description, $send_all_posts_to = '') {
 		if (strlen($project_name) < 3) {
 			$this->setError(_('Title Must Be At Least 5 Characters'));
 			return false;
@@ -344,14 +344,14 @@
 			return false;
 		}
 
-		$res = db_query_params ('UPDATE project_group_list SET project_name=$1,
-			description=$2,	send_all_posts_to=$3
+		$res = db_query_params('UPDATE project_group_list SET project_name=$1,
+			description=$2, send_all_posts_to=$3
 			WHERE group_id=$4 AND group_project_id=$5',
-					array (htmlspecialchars($project_name),
-					       htmlspecialchars($description),
-					       $send_all_posts_to,
-					       $this->Group->getID(),
-					       $this->getID())) ;
+					array(htmlspecialchars($project_name),
+					      htmlspecialchars($description),
+					      $send_all_posts_to,
+					      $this->Group->getID(),
+					      $this->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError('Error On Update: '.db_error().$sql);
@@ -361,136 +361,126 @@
 	}
 
 	/**
-	 *	delete - delete this subproject and all its related data.
+	 * delete - delete this subproject and all its related data.
 	 *
-	 *	@param  bool	I'm Sure.
-	 *	@param  bool	I'm REALLY sure.
-	 *	@return   bool true/false;
+	 * @param	bool	I'm Sure.
+	 * @param	bool	I'm REALLY sure.
+	 * @return	bool	true/false;
 	 */
 	function delete($sure, $really_sure) {
 		if (!$sure || !$really_sure) {
 			$this->setMissingParamsError();
 			return false;
 		}
-		if (!forge_check_perm ('pm', $this->getID(), 'manager')) {
+		if (!forge_check_perm('pm', $this->getID(), 'manager')) {
 			$this->setPermissionDeniedError();
 			return false;
 		}
 
 		db_begin();
 
-                $res = db_query_params ('DELETE FROM project_assigned_to
+		$res = db_query_params('DELETE FROM project_assigned_to
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=project_assigned_to.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-		$res = db_query_params ('DELETE FROM project_dependencies
+		$res = db_query_params('DELETE FROM project_dependencies
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=project_dependencies.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-		$res = db_query_params ('DELETE FROM project_history
+		$res = db_query_params('DELETE FROM project_history
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=project_history.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-                $res = db_query_params ('DELETE FROM project_messages
+		$res = db_query_params('DELETE FROM project_messages
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=project_messages.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-                $res = db_query_params ('DELETE FROM project_task_artifact
+		$res = db_query_params('DELETE FROM project_task_artifact
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=project_task_artifact.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-                $res = db_query_params ('DELETE FROM rep_time_tracking
+		$res = db_query_params('DELETE FROM rep_time_tracking
 			WHERE EXISTS (SELECT project_task_id FROM project_task
 			WHERE group_project_id=$1
 			AND project_task.project_task_id=rep_time_tracking.project_task_id)',
-					array ($this->getID())) ;
+					array($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
-                $res = db_query_params ('DELETE FROM project_task
+		$res = db_query_params ('DELETE FROM project_task
 			WHERE group_project_id=$1',
-					array ($this->getID())) ;
+					array ($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
 		$res = db_query_params ('DELETE FROM project_category WHERE group_project_id=$1',
-					array ($this->getID())) ;
+					array ($this->getID()));
 
-		if (!$res)
-		{
+		if (!$res) {
 			$this->setError('DATABASE '.db_error());
 			return false;
 		}
 
 		$res = db_query_params ('DELETE FROM project_group_list WHERE group_project_id=$1',
-					array ($this->getID())) ;
+					array ($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
 		$res = db_query_params ('DELETE FROM project_counts_agg WHERE group_project_id=$1',
-					array ($this->getID())) ;
+					array ($this->getID()));
 
-                if (!$res)
-                {
-                        $this->setError('DATABASE '.db_error());
-                        return false;
-                }
+		if (!$res) {
+			$this->setError('DATABASE '.db_error());
+			return false;
+		}
 
 		db_commit();
 
-		$this->Group->normalizeAllRoles () ;
+		$this->Group->normalizeAllRoles();
 
 		return true;
 	}

Modified: trunk/src/common/survey/Survey.class.php
===================================================================
--- trunk/src/common/survey/Survey.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/survey/Survey.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -4,6 +4,7 @@
  *
  * Copyright 2004, Sung Kim/GForge, LLC
  * Copyright 2009, Roland Mas
+ * http://fusionforge.org
  *
  * This file is part of FusionForge.
  *
@@ -31,33 +32,33 @@
 	/**
 	 * Associative array of data from db.
 	 *
-	 * @var	 array   $data_array.
+	 * @var	array	$data_array.
 	 */
 	var $data_array;
 
 	/**
-         * Questions array in this survey
-         *
-         * @var array   $question_array.
-         */
+	 * Questions array in this survey
+	 *
+	 * @var	array	$question_array.
+	 */
 	var $all_question_array;
-          
+
 	/**
 	 * The Group object.
 	 *
-	 * @var	 object  $Group.
+	 * @var	object	$Group.
 	 */
 	var $Group; 
 
 	/**
-	 *  Constructor.
+	 * Constructor.
 	 *
-	 *  @param  object	The Group object to which this servey is associated.
-	 *  @param  int	        The servey_id.
-	 *  @param  array	The associative array of data.
-	 *  @return boolean	success.
+	 * @param	object	The Group object to which this servey is associated.
+	 * @param	int	The servey_id.
+	 * @param	array	The associative array of data.
+	 * @return	boolean	success.
 	 */
-	function Survey(&$Group, $survey_id=false, $arr=false) {
+	function Survey(&$Group, $survey_id = false, $arr = false) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
 			$this->setError(sprintf(_('%1$s:: No Valid Group Object'), "Survey"));
@@ -87,41 +88,42 @@
 	}
 
 	/**
-	 *	create - use this function to create a survey 
+	 * create - use this function to create a survey 
 	 *
-	 *	@param	string	          The survey title
-	 *	@param	int array         The question numbers to be added
-	 *	@param  is_active         1: Active, 0: Inactive
-	 *	For future options
-	 *	@param  is_public         0: Admins Only, 1: Group Members, 2: Gforge user, 3:Every body
-	 *	@param  is_result_public  0: Admins Only, 1: Group Members, 2: Gforge user, 3:voted user 4:Every body
-	 *	@param  double_vote       Allow double vote if it is 1
-	 *	@return	boolean	success.
+	 * @param	string	          The survey title
+	 * @param	int array         The question numbers to be added
+	 * @param	is_active         1: Active, 0: Inactive
+	 * For future options
+	 * @param	is_public         0: Admins Only, 1: Group Members, 2: Gforge user, 3:Every body
+	 * @param	is_result_public  0: Admins Only, 1: Group Members, 2: Gforge user, 3:voted user 4:Every body
+	 * @param	double_vote       Allow double vote if it is 1
+	 * @return	boolean	success.
 	 */
-	function create($survey_title, $add_questions, $is_active=0, $is_public=1, $is_result_public=0, $double_vote=0) {
+	function create($survey_title, $add_questions, $is_active = 0, $is_public = 1, $is_result_public = 0, $double_vote = 0) {
 		if (!$survey_title) {
 			$this->setError(_('Update Failed: Survey Title Required'));
 			return false;
-			/* We need at least one survey question at this point */	
+			/* We need at least one survey question at this point */
 		} else if (!$add_questions || !is_array($add_questions) || count($add_questions)<1) {
 			$this->setError(_('Update Failed: Survey Questions Required'));
 			return false;
 		}
 
 		$group_id = $this->Group->GetID();
-		
+
 		/* Make old style survey string from array: 1, 2, 3, ..., n */
 		$survey_questions = $this->_makeQuestionString(array_reverse($add_questions));
 
-		$result = db_query_params ('INSERT INTO surveys (survey_title,group_id,survey_questions,is_active) VALUES ($1,$2,$3,$4)',
-					   array (htmlspecialchars($survey_title),
-						  $group_id,
-						  $survey_questions,
-						  $is_active)) ;
+		$result = db_query_params('INSERT INTO surveys (survey_title,group_id,survey_questions,is_active) VALUES ($1,$2,$3,$4)',
+						array(htmlspecialchars($survey_title),
+							$group_id,
+							$survey_questions,
+							$is_active)
+					);
 		if (!$result) {
 			$this->setError(_('Insert Error').db_error());
 			return false;
-		} 
+		}
 
 		/* Load question to data array */
 		$survey_id=db_insertid($result,'surveys','survey_id');
@@ -131,22 +133,22 @@
 
 
 	/**
-	 *	update - use this function to update a survey 
+	 * update - use this function to update a survey 
 	 *
-	 *	@param	string	          The survey title
-	 *	@param	int array         The question numbers to be added
-	 *	@param	int array         The question numbers to be deleted
-	 *	@param  is_active         1: Active, 0: Inactive
-	 *	@param  is_public         0: Admins Only, 1: Group Members, 2: Gforge user, 3:Every body
-	 *	@param  is_result_public  0: Admins Only, 1: Group Members, 2: Gforge user, 3:voted user 4:Every body
-	 *	@param  double_vote       Allow double vote if it is 1
-	 *	@return	boolean	success.
+	 * @param	string	          The survey title
+	 * @param	int array         The question numbers to be added
+	 * @param	int array         The question numbers to be deleted
+	 * @param	is_active         1: Active, 0: Inactive
+	 * @param	is_public         0: Admins Only, 1: Group Members, 2: Gforge user, 3:Every body
+	 * @param	is_result_public  0: Admins Only, 1: Group Members, 2: Gforge user, 3:voted user 4:Every body
+	 * @param	double_vote       Allow double vote if it is 1
+	 * @return	boolean	success.
 	 */
-	function update($survey_title, &$add_questions, &$del_questions, $is_active=0, $is_public=1, $is_result_public=0, $double_vote=0) {
+	function update($survey_title, &$add_questions, &$del_questions, $is_active = 0, $is_public = 1, $is_result_public = 0, $double_vote = 0) {
 		if (!$survey_title) {
 			$this->setError(_('Update Failed: Survey Title Required'));
 			return false;
-			/* We need at least one survey question at this point */	
+			/* We need at least one survey question at this point */
 		}
 
 		$group_id = $this->Group->GetID();
@@ -157,33 +159,34 @@
 			$this->setError(_('The Survey data is not filled'));
 			return false;
 		}
-		
+
 		if (is_array($add_questions))
 			$add_questions = array_reverse($add_questions);
 			
 		$survey_questions = $this->_updateQuestionString($add_questions, $del_questions);
-		$result = db_query_params ('UPDATE surveys SET survey_title=$1, survey_questions=$2, is_active=$3 WHERE survey_id=$4 AND group_id=$5',
-					   array (htmlspecialchars($survey_title),
-						  $survey_questions,
-						  $is_active,
-						  $survey_id,
-						  $group_id)) ;
+		$result = db_query_params('UPDATE surveys SET survey_title=$1, survey_questions=$2, is_active=$3 WHERE survey_id=$4 AND group_id=$5',
+						array (htmlspecialchars($survey_title),
+							$survey_questions,
+							$is_active,
+							$survey_id,
+							$group_id)
+					);
 		if (db_affected_rows($result) < 1) {
 			 $this->setError(_('UPDATE FAILED').db_error());
 			 return false;
-		} 
+		}
 		/* Update internal data */
 		return $this->fetchData($survey_id);
 	}
 
-        /**
-	 *	updateOrder - use this function to update question order
+	/**
+	 * updateOrder - use this function to update question order
 	 *
-	 *	@param	int 	          Question number
-	 *	@param	boolean           decide up or down. it is up if it is true
-	 *	@return	boolean	success.
+	 * @param	int 	Question number
+	 * @param	boolean	decide up or down. it is up if it is true
+	 * @return	boolean	success.
 	 */
-	function updateOrder($question_number, $is_up=true) {
+	function updateOrder($question_number, $is_up = true) {
 		$group_id = $this->Group->GetID();
 		$survey_id = $this->getID();
 
@@ -201,22 +204,23 @@
 		}
 
 		$survey_questions = $this->_updateQuestionStringOrder($question_number, $delta);
-		$result = db_query_params ('UPDATE surveys SET survey_questions=$1 WHERE survey_id=$2 AND group_id=$3',
-					   array ($survey_questions,
-						  $survey_id,
-						  $group_id)) ;
+		$result = db_query_params('UPDATE surveys SET survey_questions=$1 WHERE survey_id=$2 AND group_id=$3',
+						array ($survey_questions,
+							$survey_id,
+							$group_id)
+					);
 		if (db_affected_rows($result) < 1) {
-			 $this->setError(_('UPDATE FAILED').db_error());
-			 return false;
-		} 
+			$this->setError(_('UPDATE FAILED').db_error());
+			return false;
+		}
 		
-                /* Update internal data */
+		/* Update internal data */
 		return $this->fetchData($survey_id);
 	}
 
 	/**
-	 *	delete - use this function to delete this survey
-	 *               (We don't support delete yet)
+	 * delete - use this function to delete this survey
+	 * (We don't support delete yet)
 	 *
 	 *	@return	boolean	success.
 	 */
@@ -224,32 +228,31 @@
 		$group_id = $this->Group->GetID();
 		$survey_id = $this->getID();
 
-		$res = db_query_params ('DELETE FROM surveys where survey_id=$1 AND group_id=$2',
-					array ($survey_id,
-					       $group_id)) ;
+		$res = db_query_params('DELETE FROM surveys where survey_id=$1 AND group_id=$2',
+					array($survey_id, $group_id)
+					);
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('Delete failed').db_error());
 			return false;
 		}
-		
+
 		/* Delete internal data */
 		$this->data_array = null;
 		return true;
 	}
 
 	/**
-	 *  fetchData - re-fetch the data for this survey from the database.
+	 * fetchData - re-fetch the data for this survey from the database.
 	 *
-	 *  @param  int	 The survey_id.
-	 *  @return	boolean	success.
+	 * @param	int	The survey_id.
+	 * @return	boolean	success.
 	 */
 	function fetchData($survey_id) {
 		$group_id = $this->Group->GetID();
 		
-		$res = db_query_params ('SELECT * FROM surveys where survey_id=$1 AND group_id=$2',
-					array ($survey_id,
-					       $group_id)) ;
-	
+		$res = db_query_params('SELECT * FROM surveys where survey_id=$1 AND group_id=$2',
+					array($survey_id, $group_id)) ;
+
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('No Survey is found').db_error());
 			return false;
@@ -260,7 +263,7 @@
 	}
 
 	/**
-	 *	getGroup - get the Group object this Survey is associated with.
+	 * getGroup - get the Group object this Survey is associated with.
 	 *
 	 *	@return	object	The Group object.
 	 */
@@ -376,9 +379,9 @@
 	}
 
 	/**
-	 *	getQuestionInstances - Get the SurveyQuestion array belongs to this Survey by order
+	 * getQuestionInstances - Get the SurveyQuestion array belongs to this Survey by order
 	 *
-	 *	@return string the question
+	 * @return	string	the question
 	 */
 	function &getQuestionInstances() {
 		$ret = array();
@@ -388,7 +391,7 @@
 		}
 
 		$arr = & $this->getQuestionArray();
-		
+
 		for ($i=0; $i<count($arr); $i++) {
 			for ($j=0; $j<count($this->all_question_array); $j++) {
 				/* If it is, copy into new array in order */
@@ -398,14 +401,14 @@
 				}
 			}
 		}
-		
+
 		return $ret;
 	}
-	
+
 	/**
-	 *	getAddableQuestionInstances - Get the addable SurveyQuestion from all questions
+	 * getAddableQuestionInstances - Get the addable SurveyQuestion from all questions
 	 *
-	 *	@return string the question
+	 * @return	string	the question
 	 */
 	function &getAddableQuestionInstances() {
 		$ret = array();
@@ -415,32 +418,32 @@
 		}
 
 		$arr = & $this->getQuestionArray();
-		if ($arr) {		
+		if ($arr) {
 			/* Copy questions only if it is not in question string */
 			for ($i=0; $i<count($this->all_question_array); $i++) {
-				if (array_search($this->all_question_array[$i]->getID(), $arr)==false && 
-				    $this->all_question_array[$i]->getID()!=$arr[0]) {
+				if (array_search($this->all_question_array[$i]->getID(), $arr) == false && 
+					$this->all_question_array[$i]->getID()!=$arr[0]) {
 					$ret[] = $this->all_question_array[$i];
 				}
 			}
 		} else {
 			$ret = $this->all_question_array;
 		}
-		
+
 		return $ret;
 	}
 
 	/***************************************************************
-         * private question string deal methods
-         * TODO: Add a joint table for surveys and survey_questions. 
-         *       Deal with DBMS not comma separated string
+	 * private question string deal methods
+	 * TODO: Add a joint table for surveys and survey_questions. 
+	 *       Deal with DBMS not comma separated string
          ***************************************************************/
 
 	/**
-	 *      _fillSurveyQuestions - Get all Survey Questions using SurveyQuestionFactory
-         *
-         *      @return booelan suesssness
-         */
+	 * _fillSurveyQuestions - Get all Survey Questions using SurveyQuestionFactory
+	 *
+	 * @return	boolean	success
+	 */
 	function _fillSurveyQuestions() {
 		$sqf = new SurveyQuestionFactory($this->getGroup());
 		$this->all_question_array = & $sqf->getSurveyQuestions();
@@ -448,10 +451,10 @@
 
 	
 	/**
-	 *  _isValidQuestionID - Check it is correct question id
+	 * _isValidQuestionID - Check it is correct question id
 	 *
-	 *  @param int questioin id 
-	 *  @return boolean true if it is valid question id
+	 * @param	int	questioin id 
+	 * @return	boolean	true if it is valid question id
 	 */
 	function _isValidQuestionID($question_id) {
 		if (!$this->all_question_array || !is_array($this->all_question_array)) {
@@ -465,16 +468,16 @@
 		}
 		return false;
 	}
- 	
-	
+
+
 	/**
-	 *  _makeQuestionString - Make comma separated question number string
+	 * _makeQuestionString - Make comma separated question number string
 	 *
-	 *  @param    int array	 Array of question number
-	 *  @return   string     question_strong (example: 1, 2, 3, 7);
+	 * @param	int array	Array of question number
+	 * @return	string		question_strong (example: 1, 2, 3, 7);
 	 */
 	function _makeQuestionString($arr) {
-		
+
 		/* No questions to add */
 		if (!$arr || !is_array($arr) || count($arr)<1) {
 			return '';
@@ -483,11 +486,11 @@
 	}
 
 	/**
-	 *  _updateQuestionString - Update comma saparated question number string
+	 * _updateQuestionString - Update comma saparated question number string
 	 *
-	 *  @param    int array	 Array of questions to add
-	 *  @param    int array	 Array of questions to delete
-	 *  @return   string     question_strong (example: 1, 2, 3, 7);
+	 * @param	int array	Array of questions to add
+	 * @param	int array	Array of questions to delete
+	 * @return	string		question_strong (example: 1, 2, 3, 7);
 	 */
 	function _updateQuestionString(&$arr_to_add, &$arr_to_del) {
 		/* Get array of current question string */
@@ -500,10 +503,10 @@
 			if ($arr_to_add && is_array($arr_to_add) && count($arr_to_add)>0) {
 				for ($i = 0; $i < count($arr_to_add); $i++) {
 				/* Avoid double question */
-					if ($arr_to_add[$i] && array_search($arr_to_add[$i], $arr)==false && $arr_to_add[$i]!=$arr[0]) {
+					if ($arr_to_add[$i] && array_search($arr_to_add[$i], $arr) == false && $arr_to_add[$i]!=$arr[0]) {
 						$arr[] = $arr_to_add[$i];
 					}
-				}  
+				}
 			}
 		}
 		
@@ -515,7 +518,7 @@
 				if ($arr[$i] && array_search($arr[$i], $arr_to_del)==false && $arr_to_del[0]!=$arr[$i]) {
 					$new_arr[] = $arr[$i];
 				}
-			}  
+			}
 			/* copy new_arr to arr */
 			$arr = $new_arr;
 		}
@@ -524,12 +527,12 @@
 		return $this->_makeQuestionString($arr);
 	}
 
-        /**
-	 *  _updateArrayOrder - Update array order
+	/**
+	 * _updateArrayOrder - Update array order
 	 *
-	 *  @param    int 	 question number
-	 *  @param    int	 increment or decrement (must be 1 or -1)
-	 *  @return   string     question_strong (example: 1, 2, 3, 7);
+	 * @param	int	question number
+	 * @param	int	increment or decrement (must be 1 or -1)
+	 * @return	string	question_strong (example: 1, 2, 3, 7);
 	 */
 	function _updateQuestionStringOrder($question_number, $delta) {
 		/* Get array of current question string */
@@ -541,10 +544,10 @@
 		}
 
 		$index = array_search($question_number, $arr);
-		
+
 		/* The question number is not in the array 
 		 * We have nothing to change 
-		 */ 
+		 */
 		if ($index==false && $question_number!=$arr[0]) {
 			return $this->getQuestionString();
 		}

Modified: trunk/src/common/survey/SurveyFactory.class.php
===================================================================
--- trunk/src/common/survey/SurveyFactory.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/survey/SurveyFactory.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -4,6 +4,7 @@
  *
  * Copyright 2004, Sung Kim/GForge, LLC
  * Copyright 2009, Roland Mas
+ * http://fusionforge.org
  *
  * This file is part of FusionForge.
  *
@@ -28,27 +29,27 @@
 
 class SurveyFactory extends Error {
 
-       /**
-        * The Group object.
-        *
-        * @var	 object  $Group.
-        */
+	/**
+	 * The Group object.
+	 *
+	 * @var	object	$Group.
+	 */
 	var $Group;
 
 	/**
 	 * The survey array.
 	 *
-	 * @var	 array	survey.
+	 * @var	array	survey.
 	 */
 	var $surveys;
 
 	/**
-	 *  Constructor. 
+	 * Constructor.
 	 *
-	 *	@param	object	The Group object to which this survey is associated.
-         *      @param  int     The survey_id
+	 * @param	object	The Group object to which this survey is associated.
+	 * @param	int	The survey_id
 	 */
-	function SurveyFactory(&$Group) { 
+	function SurveyFactory(&$Group) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
 			$this->setError(_('No valid Group Object'));
@@ -60,36 +61,34 @@
 			return false;
 		}
 		$this->Group =& $Group;
-
 		return true;
 	}
 
 	/**
-	 *	getGroup - get the Group object this SurveyQuestionFactory is associated with.
+	 * getGroup - get the Group object this SurveyQuestionFactory is associated with.
 	 *
-	 *	@return object	The Group object.
+	 * @return	object	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
 	}
 
 	/**
-	 *	getSurveyQuestion - get an array of Survey Question objects 
-         *                          for this Group and Survey id if survey_id is given.
+	 * getSurveyQuestion - get an array of Survey Question objects 
+	 * for this Group and Survey id if survey_id is given.
 	 *
- 	 *	@return	array	The array of Survey Question objects.
+ 	 * @return	array	The array of Survey Question objects.
 	 */
 	function &getSurveys() {
 		/* We alread have it */
 		if ($this->surveys) {
 			return $this->surveys;
 		}
-		
-		$result = db_query_params ('SELECT * FROM surveys WHERE group_id=$1 ORDER BY survey_id DESC',
-					   array ($this->Group->getID()));
+		$result = db_query_params('SELECT * FROM surveys WHERE group_id=$1 ORDER BY survey_id DESC',
+						array ($this->Group->getID()));
 
 		if (!$result) {
-			$this->setError(_('No Survey is found').db_error());
+			$this->setError(_('No Survey is found').' '.db_error());
 			return false;
 		} else {
 			$this->surveys = array();

Modified: trunk/src/common/survey/SurveyQuestion.class.php
===================================================================
--- trunk/src/common/survey/SurveyQuestion.class.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/common/survey/SurveyQuestion.class.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -30,26 +30,26 @@
 	/**
 	 * Associative array of data from db.
 	 *
-	 * @var	 array   $data_array.
+	 * @var	array	$data_array.
 	 */
 	var $data_array;
 
 	/**
 	 * The Group object.
 	 *
-	 * @var	 object  $Group.
+	 * @var	object	$Group.
 	 */
 	var $Group; //group object
 
 	/**
-	 *  Constructor.
+	 * Constructor.
 	 *
-	 *  @param  object	The Group object to which this Survey Question is associated.
-	 *  @param  int	        The questtion_id.
-	 *  @param  array	The associative array of data.
-	 *  @return boolean	success.
+	 * @param	object	The Group object to which this Survey Question is associated.
+	 * @param	int	The questtion_id.
+	 * @param	array	The associative array of data.
+	 * @return	boolean	success.
 	 */
-	function SurveyQuestion(&$Group, $question_id=false, $arr=false) {
+	function SurveyQuestion(&$Group, $question_id = false, $arr = false) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
 			$this->setError(sprintf(_('%1$s:: No Valid Group Object'), 'Survey Question'));
@@ -79,19 +79,19 @@
 	}
 
 	/**
-	 *	create - use this function to create a survey question
+	 * create - use this function to create a survey question
 	 *
-	 *	@param	string	The question
-	 *	@param	int     The question type
-         *                      1: Radio Buttons 1-5
-         *                      2: Text Area
-         *                      3: Radio Buttons Yes/No
-         *                      4: Comment Only
-         *                      5: Text Field
-         *                      6: None
-	 *	@return	boolean	success.
+	 * @param	string	The question
+	 * @param	int	The question type
+	 *                      1: Radio Buttons 1-5
+	 *                      2: Text Area
+	 *                      3: Radio Buttons Yes/No
+	 *                      4: Comment Only
+	 *                      5: Text Field
+	 *                      6: None
+	 * @return	boolean	success.
 	 */
-	function create($question, $question_type=1) {
+	function create($question, $question_type = 1) {
 		if (strlen($question) < 3) {
 			$this->setError(_('Question is too short'));
 			return false;
@@ -102,36 +102,36 @@
 
 		$group_id = $this->Group->GetID();
 
-		$res = db_query_params ('INSERT INTO survey_questions (group_id,question,question_type) VALUES ($1,$2,$3)',
-					array ($group_id,
-					       htmlspecialchars($question),
-					       $question_type)) ;
+		$res = db_query_params('INSERT INTO survey_questions (group_id,question,question_type) VALUES ($1,$2,$3)',
+					array($group_id,
+					      htmlspecialchars($question),
+					      $question_type));
 		if (!$res) {
 			$this->setError(_('Question Added').db_error());
 			return false;
 		} 
 
 		/* Load question to data array */
-		$question_id=db_insertid($res,'survey_questions','question_id');
+		$question_id = db_insertid($res,'survey_questions','question_id');
 		return $this->fetchData($question_id);
 	}
 
 
-	
+
 	/**
-	 *	update - use this function to update a survey question
+	 * update - use this function to update a survey question
 	 *
-	 *	@param	string	The question
-	 *	@param	int     The question type
-         *                      1: Radio Buttons 1-5
-         *                      2: Text Area
-         *                      3: Radio Buttons Yes/No
-         *                      4: Comment Only
-         *                      5: Text Field
-         *                      6: None
+	 * @param	string	The question
+	 * @param	int	The question type
+	 *                      1: Radio Buttons 1-5
+	 *                      2: Text Area
+	 *                      3: Radio Buttons Yes/No
+	 *                      4: Comment Only
+	 *                      5: Text Field
+	 *                      6: None
 	 *	@return	boolean	success.
 	 */
-	function update($question, $question_type=1) {
+	function update($question, $question_type = 1) {
 		if (strlen($question) < 3) {
 			$this->setError(_('Question is too short'));
 			return false;
@@ -143,11 +143,11 @@
 		$group_id = $this->Group->GetID();
 		$question_id = $this->getID();
 
-		$res = db_query_params ('UPDATE survey_questions SET question=$1, question_type=$2 where question_id=$3 AND group_id=$4',
-					array (htmlspecialchars($question),
-					       $question_type,
-					       $question_id,
-					       $group_id));
+		$res = db_query_params('UPDATE survey_questions SET question=$1, question_type=$2 where question_id=$3 AND group_id=$4',
+					array(htmlspecialchars($question),
+					      $question_type,
+					      $question_id,
+					      $group_id));
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('UPDATE FAILED').db_error());
 			return false;
@@ -156,17 +156,17 @@
 	}
 
 	/**
-	 *	delete - use this function to delete a survey question
+	 * delete - use this function to delete a survey question
 	 *
-	 *	@return	boolean	success.
+	 * @return	boolean	success.
 	 */
 	function delete() {
 		$group_id = $this->Group->GetID();
 		$question_id = $this->getID();
 
-		$res = db_query_params ('DELETE FROM survey_questions where question_id=$1 AND group_id=$2',
-					array ($question_id,
-					       $group_id)) ;
+		$res = db_query_params('DELETE FROM survey_questions where question_id=$1 AND group_id=$2',
+					array($question_id,
+					      $group_id));
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('Delete failed').db_error());
 			return false;
@@ -177,22 +177,22 @@
 	}
 
 	/**
-	 *  fetchData - re-fetch the data for this survey question from the database.
+	 * fetchData - re-fetch the data for this survey question from the database.
 	 *
-	 *  @param  int	 The survey question_id.
-	 *  @return	boolean	success.
+	 * @param	int	The survey question_id.
+	 * @return	boolean	success.
 	 */
 	function fetchData($question_id) {
 		$group_id = $this->Group->GetID();
 		
-		$res = db_query_params ('SELECT survey_questions.*, survey_question_types.type 
-                      FROM survey_questions ,survey_question_types 
-                      WHERE  survey_question_types.id=survey_questions.question_type 
-                      AND    survey_questions.question_id=$1
-                      AND  survey_questions.group_id=$2',
-					array ($question_id,
-					       $group_id)) ;
-	
+		$res = db_query_params('SELECT survey_questions.*, survey_question_types.type 
+		      FROM survey_questions ,survey_question_types 
+		      WHERE survey_question_types.id=survey_questions.question_type 
+		      AND survey_questions.question_id=$1
+		      AND survey_questions.group_id=$2',
+					array($question_id,
+					      $group_id));
+
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Error finding question').db_error());
 			return false;
@@ -203,48 +203,47 @@
 	}
 
 	/**
-	 *	getGroup - get the Group object this SurveyQuestion is associated with.
+	 * getGroup - get the Group object this SurveyQuestion is associated with.
 	 *
-	 *	@return	object	The Group object.
+	 * @return	object	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
 	}
 
 	/**
-	 *	getID - Get the id of this Survey Question
+	 * getID - Get the id of this Survey Question
 	 *
-	 *	@return	int	The question_id
+	 * @return	int	The question_id
 	 */
 	function getID() {
 		return $this->data_array['question_id'];
 	}
 
-	
-        /**
-	 *	getQuestion - Get the question
+	/**
+	 * getQuestion - Get the question
 	 *
-	 *	@return string the question
+	 * @return	string	the question
 	 */
 	function getQuestion() {
 		return $this->data_array['question'];
 	}
 
 
-        /**
-	 *	getQuestionType - Get the question type
+	/**
+	 * getQuestionType - Get the question type
 	 *
-	 *	@return int the question type
+	 * @return	int	the question type
 	 */
 	function getQuestionType() {
 		return $this->data_array['question_type'];
 	}
 
 
-        /**
-	 *	getQuestionStringType - Get the type from survey_question_types
+	/**
+	 * getQuestionStringType - Get the type from survey_question_types
 	 *
-	 *	@return String the question type
+	 * @return	string	the question type
 	 */
 	function getQuestionStringType() {
 		return $this->data_array['type'];

Modified: trunk/src/www/admin/groupdelete.php
===================================================================
--- trunk/src/www/admin/groupdelete.php	2010-12-12 12:48:55 UTC (rev 11777)
+++ trunk/src/www/admin/groupdelete.php	2010-12-12 12:53:14 UTC (rev 11778)
@@ -43,7 +43,7 @@
 	$reallysure = getIntFromPost('reallysure');
 	$reallyreallysure = getIntFromPost('reallyreallysure');
 	if (!$group->delete($sure, $reallysure, $reallyreallysure)) {
-		exit_error($group->getErrorMessage(),'admin');
+		exit_error($group->getErrorMessage(), 'admin');
 	} else {
 		plugin_hook('delete_link',$_GET['group_id']);
 		$feedback = _('Project successfully deleted');




More information about the Fusionforge-commits mailing list