[Fusionforge-commits] r17577 - trunk/src/common/pm

Marc-Etienne VARGENAU vargenau at fusionforge.org
Fri Jul 19 10:09:39 CEST 2013


Author: vargenau
Date: 2013-07-19 10:09:39 +0200 (Fri, 19 Jul 2013)
New Revision: 17577

Modified:
   trunk/src/common/pm/ProjectCategory.class.php
   trunk/src/common/pm/ProjectGroup.class.php
   trunk/src/common/pm/ProjectGroupFactory.class.php
   trunk/src/common/pm/ProjectTask.class.php
   trunk/src/common/pm/ProjectTaskFactory.class.php
   trunk/src/common/pm/ProjectTasksForUser.class.php
Log:
Update PHPDoc comments

Modified: trunk/src/common/pm/ProjectCategory.class.php
===================================================================
--- trunk/src/common/pm/ProjectCategory.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectCategory.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -29,22 +29,22 @@
 	/**
 	 * The ProjectGroup object.
 	 *
-	 * @var		object	$ProjectGroup.
+	 * @var	ProjectGroup	$ProjectGroup.
 	 */
 	var $ProjectGroup; //object
 
 	/**
 	 * Array of data.
 	 *
-	 * @var		array	$data_array.
+	 * @var	array	$data_array.
 	 */
 	var $data_array;
 
 	/**
 	 *  ProjectCategory - constructor.
 	 *
-	 *	@param	object	ProjectGroup object.
-	 *  @param	array	(all fields from project_category) OR category_id from database.
+	 *	@param	object	   $ProjectGroup ProjectGroup object.
+	 *  @param	array|bool $data (all fields from project_category) OR category_id from database.
 	 *  @return	boolean	success.
 	 */
 	function ProjectCategory(&$ProjectGroup, $data=false) {
@@ -77,13 +77,14 @@
 				}
 			}
 		}
+		return true;
 	}
 
 	/**
-	 *	create - create a new item in the database.
+	 * create - create a new item in the database.
 	 *
-	 *	@param	string	Item name.
-	 *  @return	boolean success.
+	 * @param  string    $name Item name.
+	 * @return boolean success.
 	 */
 	function create($name) {
 		//
@@ -124,7 +125,7 @@
 	/**
 	 *	fetchData() - re-fetch the data for this ProjectCategory from the database.
 	 *
-	 *	@param	int		ID of the category.
+	 *	@param	int	$id	ID of the category.
 	 *	@return	boolean	success.
 	 */
 	function fetchData($id) {
@@ -169,7 +170,7 @@
 	/**
 	 *  update - update a ProjectCategory.
 	 *
-	 *  @param	string	Name of the category.
+	 *  @param	string	$name Name of the category.
 	 *  @return	boolean success.
 	 */
 	function update($name) {

Modified: trunk/src/common/pm/ProjectGroup.class.php
===================================================================
--- trunk/src/common/pm/ProjectGroup.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectGroup.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -78,7 +78,7 @@
 	/**
 	 * The Group object.
 	 *
-	 * @var	object	$Group.
+	 * @var	Group $Group.
 	 */
 	var $Group;
 	var $statuses;
@@ -96,8 +96,7 @@
 	function ProjectGroup(&$Group, $group_project_id = false, $arr = false) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
-			$this->setError('ProjectGroup:: No Valid Group Object');
-			return false;
+			exit_no_group();
 		}
 		if ($Group->isError()) {
 			$this->setError('ProjectGroup:: '.$Group->getErrorMessage());
@@ -201,7 +200,7 @@
 	/**
 	 * getGroup - get the Group object this ProjectGroup is associated with.
 	 *
-	 * @return	object	The Group object.
+	 * @return	Group	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
@@ -342,7 +341,7 @@
 					      $this->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
-			$this->setError('Error On Update: '.db_error().$sql);
+			$this->setError('Error On Update: '.db_error());
 			return false;
 		}
 		return true;

Modified: trunk/src/common/pm/ProjectGroupFactory.class.php
===================================================================
--- trunk/src/common/pm/ProjectGroupFactory.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectGroupFactory.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -45,14 +45,13 @@
 	/**
 	 *  Constructor.
 	 *
-	 *	@param	object	The Group object to which this ProjectGroupFactory is associated.
+	 *	@param	Group $Group The Group object to which this ProjectGroupFactory is associated.
 	 *	@return	boolean	success.
 	 */
 	function ProjectGroupFactory(&$Group) {
 		$this->Error();
 		if (!$Group || !is_object($Group)) {
-			$this->setError('ProjectGroup:: No Valid Group Object');
-			return false;
+			exit_no_group();
 		}
 		if ($Group->isError()) {
 			$this->setError('ProjectGroup:: '.$Group->getErrorMessage());
@@ -71,7 +70,7 @@
 	/**
 	 *	getGroup - get the Group object this ProjectGroupFactory is associated with.
 	 *
-	 *	@return	object	The Group object.
+	 *	@return	Group	The Group object.
 	 */
 	function &getGroup() {
 		return $this->Group;
@@ -93,7 +92,7 @@
 	/**
 	 *	getProjectGroups - get an array of ProjectGroup objects.
 	 *
-	 *	@return	array	The array of ProjectGroups.
+	 *	@return	ProjectGroups[]	The array of ProjectGroups.
 	 */
 	function getProjectGroups() {
 		if ($this->projectGroups) {

Modified: trunk/src/common/pm/ProjectTask.class.php
===================================================================
--- trunk/src/common/pm/ProjectTask.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectTask.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -72,7 +72,7 @@
 	/**
 	 * The ProjectGroup object.
 	 *
-	 * @var	 object  $ProjectGroup.
+	 * @var	 ProjectGroup  $ProjectGroup.
 	 */
 	var $ProjectGroup;
 	var $dependon;
@@ -80,11 +80,11 @@
 	var $relatedartifacts;
 
 	/**
-	 *  Constructor.
+	 *  ProjectTask - Constructor.
 	 *
-	 *	@param	object	The ProjectGroup object to which this ProjectTask is associated.
-	 *  @param  int	 The project_task_id.
-	 *  @param  array   The associative array of data.
+	 *	@param  object	   $ProjectGroup    The ProjectGroup object to which this ProjectTask is associated.
+	 *  @param  int|bool   $project_task_id The project_task_id.
+	 *  @param  array|bool $arr             The associative array of data.
 	 *	@return	boolean success.
 	 */
 	function ProjectTask(&$ProjectGroup, $project_task_id=false, $arr=false) {
@@ -121,19 +121,20 @@
 	/**
 	 *	create - create a new ProjectTask in the database.
 	 *
-	 *	@param	string	The summary of this task.
-	 *	@param	string	The detailed description of this task.
-	 *	@param	int	The Priority of this task.
-	 *	@param	int	The Hours estimated to complete this task.
-	 *	@param	int	The (unix) start date of this task.
-	 *	@param	int	The (unix) end date of this task.
-	 *	@param	int	The category_id of this task.
-	 *	@param	int	The percentage of completion in integer format of this task.
-	 *	@param	array	An array of user_id's that are assigned this task.
-	 *	@param	array	An array of project_task_id's that this task depends on.
-	 *	@param	int	The duration of the task in days.
-	 *	@param	int	The id of the parent task, if any.
-	 *	@param	array	An array ('user' => user_id)
+	 *	@param	string	$summary          The summary of this task.
+	 *	@param	string	$details          The detailed description of this task.
+	 *	@param	int	    $priority         The Priority of this task.
+	 *	@param	int	    $hours            The Hours estimated to complete this task.
+	 *	@param	int	    $start_date       The (unix) start date of this task.
+	 *	@param	int	    $end_date         The (unix) end date of this task.
+	 *	@param	int	    $category_id      The category_id of this task.
+	 *	@param	int	    $percent_complete The percentage of completion in integer format of this task.
+	 *	@param	array	$assigned_arr     An array of user_id's that are assigned this task.
+	 *	@param	array	$depend_arr       An array of project_task_id's that this task depends on.
+	 *	@param	int	    $duration         The duration of the task in days.
+	 *	@param	int	    $parent_id        The id of the parent task, if any.
+	 *	@param	array	$importData       An array ('user' => user_id)
+	 *	@param	array	$importData       An array ('user' => user_id)
 	 *	@return	boolean success.
 	 */
 	function create($summary,$details,$priority,$hours,$start_date,$end_date,
@@ -195,7 +196,7 @@
 						  $parent_id)) ;
 
 		if (!$result || db_affected_rows($result) < 1) {
-			$this->setError('Posting Failed '.db_error());
+			$this->setError('Posting Failed'.' '.db_error());
 			db_rollback();
 			return false;
 		}
@@ -220,7 +221,7 @@
 	/**
 	 *  fetchData - re-fetch the data for this ProjectTask from the database.
 	 *
-	 *  @param  int	 The project_task_id.
+	 *  @param  int	$project_task_id The project_task_id.
 	 *  @return	boolean	success.
 	 */
 	function fetchData($project_task_id) {
@@ -230,7 +231,7 @@
 					array ($project_task_id,
 					       $this->ProjectGroup->getID())) ;
 		if (!$res || db_numrows($res) < 1) {
-			$this->setError('Invalid Task ID'.db_error());
+			$this->setError(_('Invalid Task ID').' '.db_error());
 			return false;
 		}
 		$this->data_array = db_fetch_array($res);
@@ -241,7 +242,7 @@
 	/**
 	 *	getProjectGroup - get the ProjectGroup object this ProjectTask is associated with.
 	 *
-	 *	@return	Object	The ProjectGroup object.
+	 *	@return	ProjectGroup The ProjectGroup object.
 	 */
 	function &getProjectGroup() {
 		return $this->ProjectGroup;
@@ -410,7 +411,7 @@
 					array ($id,
 					       $this->getID())) ;
 		if (db_affected_rows($res) < 1) {
-			$res = db_query_params ('INSERT INTO project_task_external_order (project_task_id,external_id) VALUES ($1, $2)',
+			db_query_params ('INSERT INTO project_task_external_order (project_task_id,external_id) VALUES ($1, $2)',
 						array ($this->getID(),
 						       $id)) ;
 		}
@@ -428,7 +429,7 @@
 	/**
 	 *	getRelatedArtifacts - Return a result set of artifacts which are related to this task.
 	 *
-	 *	@returns Database result set.
+	 *	@return Database result set.
 	 */
 	function getRelatedArtifacts() {
 		if (!$this->relatedartifacts) {
@@ -448,7 +449,7 @@
 	/**
 	 *	addRelatedArtifacts - take an array of artifact_id's and build relationships.
 	 *
-	 *	@param	array	An array of artifact_id's to be attached to this task.
+	 *	@param	array	$art_array An array of artifact_id's to be attached to this task.
 	 *	@return	boolean	success.
 	 */
 	function addRelatedArtifacts($art_array) {
@@ -479,7 +480,7 @@
 	/**
 	 *	removeRelatedArtifacts - take an array of artifact_id's and delete relationships.
 	 *
-	 *	@param	array	An array of artifact_id's to be removed from this task.
+	 *	@param	array	$art_array An array of artifact_id's to be removed from this task.
 	 *	@return	boolean	success.
 	 */
 	function removeRelatedArtifacts($art_array) {
@@ -505,7 +506,7 @@
 	/**
 	 *  delete - delete this tracker and all its related data.
 	 *
-	 *  @param  bool	I'm Sure.
+	 *  @param  bool	$sure I'm Sure.
 	 *  @return bool true/false;
 	 */
 	function delete($sure) {
@@ -577,7 +578,7 @@
 	 *	getOtherTasks - Return a result set of tasks in this subproject that do not equal
 	 *	the current task_id.
 	 *
-	 *	@returns Database result set.
+	 *	@return Database result set.
 	 */
 	function getOtherTasks () {
 		//
@@ -616,7 +617,8 @@
 	/**
 	 *  getMessages - get the list of messages attached to this ProjectTask.
 	 *
-	 *  @return database result set.
+	 * @param bool $asc
+	 * @return database result set.
 	 */
 	function getMessages($asc=false) {
 		return db_query_params ('SELECT *
@@ -629,9 +631,9 @@
 	/**
 	 * addMessage - Handle the addition of a followup message to this task.
 	 *
-	 * @param	string  The message.
-	 * @param	array	Specific data for import (user id and time)
-	 * @returns	boolean	success.
+	 * @param	string  $message    The message.
+	 * @param	array	$importData Specific data for import (user id and time)
+	 * @return	boolean	success.
 	 */
 	function addMessage($message, $importData = array()) {
 		//prevent posting the same message
@@ -674,10 +676,10 @@
 	/**
 	 * addHistory - Handle the insertion of history for these parameters.
 	 *
-	 * @param	string  The field name.
-	 * @param	string  The old value.
-	 * @param	array	Specific data for import (user id and time)
-	 * @returns	boolean	success.
+	 * @param	string  $field_name The field name.
+	 * @param	string  $old_value  The old value.
+	 * @param	array	$importData Specific data for import (user id and time)
+	 * @return bool
 	 */
 	function addHistory ($field_name,$old_value,$importData=array()) {
 		//Uses importData
@@ -708,14 +710,15 @@
 	/**
 	 * checkCircular - recursive function calls itself to look at all tasks you are dependent on.
 	 *
-	 * @param	int	The project_task_id you are dependent on.
-	 * @param	int	The project_task_id you are checking circular dependencies for.
-	 * @returns	boolean	success.
+	 * @param	int	$depend_on_id The project_task_id you are dependent on.
+	 * @param	int	$original_id  The project_task_id you are checking circular dependencies for.
+	 * @return	boolean	success.
 	 */
 	function checkCircular($depend_on_id, $original_id) {
 		//for msproject users - ms project has more complex logic than gforge
 		return true;
 
+        /*
 		if ($depend_on_id == $original_id) {
 			$this->setError(_('Circular Dependency Detected\''));
 	 		return false;
@@ -733,16 +736,16 @@
 			}
 		}
 		return true;
+        */
 	}
 
 	/**
 	 * setDependentOn - takes an array of project_task_id's and builds dependencies.
 	 *
-	 * @param	array	The array of project_task_id's.
-	 * @returns	boolean	success.
+	 * @param	array	$arr_ The array of project_task_id's.
+	 * @return	boolean	success.
 	 */
 	function setDependentOn(&$arr_) {
-//printr($arr_,'setDependentOn entry');
 //
 //	IMPORTANT - MUST VERIFY NO CIRCULAR DEPENDENCY!!
 //

Modified: trunk/src/common/pm/ProjectTaskFactory.class.php
===================================================================
--- trunk/src/common/pm/ProjectTaskFactory.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectTaskFactory.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -52,7 +52,7 @@
 	/**
 	 *  Constructor.
 	 *
-	 *	@param	object	The ProjectGroup object to which this ProjectTask is associated.
+	 *	@param	ProjectGroup $ProjectGroup The ProjectGroup object to which this ProjectTask is associated.
 	 *	@return	boolean	success.
 	 */
 	function ProjectTaskFactory(&$ProjectGroup) {
@@ -73,15 +73,16 @@
 	}
 
 	/**
-	 *	setup - sets up limits and sorts before you call getTasks().
+	 * setup - sets up limits and sorts before you call getTasks().
 	 *
-	 *	@param	int	The offset - number of rows to skip.
-	 *	@param	string	The way to order - ASC or DESC.
-	 *	@param	int	The max number of rows to return.
-	 *	@param	string	Whether to set these prefs into the user_prefs table - use "custom".
-	 *	@param	int	Include this param if you want to limit to a certain assignee.
-	 *	@param	int	Include this param if you want to limit to a certain category.
-	 *	@param	string	What view mode the screen should be in.
+	 * @param  int       $offset        The offset - number of rows to skip.
+	 * @param  string    $order         The way to order - ASC or DESC.
+	 * @param  int       $max_rows      The max number of rows to return.
+	 * @param  string    $set           Whether to set these prefs into the user_prefs table - use "custom".
+	 * @param  int       $_assigned_to  Include this param if you want to limit to a certain assignee.
+	 * @param  int       $_status       Include this param if you want to limit to a certain category.
+	 * @param            $_category_id
+	 * @param  string    $_view
 	 */
 	function setup($offset,$order,$max_rows,$set,$_assigned_to,$_status,$_category_id,$_view='') {
 //echo "<br />offset: $offset| order: $order|max_rows: $max_rows|_assigned_to: $_assigned_to|_status: $_status|_category_id: $_category_id +";
@@ -145,9 +146,9 @@
 	}
 
 	/**
-	 *	getTasks - get an array of ProjectTask objects.
+	 * getTasks - get an array of ProjectTask objects.
 	 *
-	 *	@return	array	The array of ProjectTask objects.
+	 * @return ProjectTask[] The array of ProjectTask objects.
 	 */
 	function &getTasks() {
 		if ($this->project_tasks) {
@@ -186,7 +187,7 @@
 		$rows = db_numrows($result);
 		$this->fetched_rows=$rows;
 		if (db_error()) {
-			$this->setError('Database Error: '.db_error().$sql);
+			$this->setError('Database Error: '.db_error());
 			return false;
 		}
 

Modified: trunk/src/common/pm/ProjectTasksForUser.class.php
===================================================================
--- trunk/src/common/pm/ProjectTasksForUser.class.php	2013-07-19 07:35:43 UTC (rev 17576)
+++ trunk/src/common/pm/ProjectTasksForUser.class.php	2013-07-19 08:09:39 UTC (rev 17577)
@@ -38,21 +38,23 @@
 	var $User;
 
 	/**
-	* Creates a new ProjectTasksForUser object
-	*
-	* @param	user	the User object
-	*/
+	 * Creates a new ProjectTasksForUser object
+	 *
+	 * @param GFUser $user	the User object
+	 * @return bool
+	 */
 	function ProjectTasksForUser(&$user) {
 		$this->User =& $user;
 		return true;
 	}
 
 	/**
-	* Gets a list of tasks for this user
-	*
-	* @param the SQL query to use to fetch the tasks
-	*	@return	an array of ProjectTask objects
-	*/
+	 * Gets a list of tasks for this user
+	 *
+	 * @param string $sql The SQL query to use to fetch the tasks
+	 * @param array  $params
+	 * @return ProjectTask[] An array of ProjectTask objects
+	 */
 	function &getTasksFromSQLwithParams ($sql, $params) {
 		$tasks = array();
 		$result = db_query_params ($sql, $params);
@@ -69,7 +71,7 @@
 	/**
 	*	Gets a list of tasks by group project name
 	*
-	* @return an array of ProjectTask objects
+	* @return array An array of ProjectTask objects
 	*/
 	function &getTasksByGroupProjectName () {
 		return $this->getTasksFromSQLwithParams ('SELECT ptv.*,g.group_name,pgl.project_name




More information about the Fusionforge-commits mailing list