[Fusionforge-commits] r11911 - trunk/src/common/docman

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Wed Dec 29 13:49:23 CET 2010


Author: nerville
Date: 2010-12-29 13:49:23 +0100 (Wed, 29 Dec 2010)
New Revision: 11911

Modified:
   trunk/src/common/docman/DocumentGroup.class.php
Log:
enhancement: getPath returns the complete path of a DocumentGroup

Modified: trunk/src/common/docman/DocumentGroup.class.php
===================================================================
--- trunk/src/common/docman/DocumentGroup.class.php	2010-12-29 12:47:01 UTC (rev 11910)
+++ trunk/src/common/docman/DocumentGroup.class.php	2010-12-29 12:49:23 UTC (rev 11911)
@@ -50,7 +50,7 @@
 	 * Use this constructor if you are modifying an existing doc_group.
 	 *
 	 * @param	object	Group object.
-	 * @param	array	(all fields from doc_groups) OR doc_group from database.
+	 * @param	array	(all fields from doc_groups) OR doc_group id from database.
 	 * @return	boolean	success.
 	 * @access	public
 	 */
@@ -84,6 +84,7 @@
 				}
 			}
 		}
+		return true;
 	}
 
 	/**
@@ -297,10 +298,11 @@
 	 * update - update a DocumentGroup.
 	 *
 	 * @param	string	Name of the category.
+	 * @param	int	the doc_group id of the parent. default = 0
 	 * @return	boolean	success or not
 	 * @access	public
 	 */
-	function update($name, $parent_doc_group) {
+	function update($name, $parent_doc_group = 0) {
 		$perm =& $this->Group->getPermission();
 		if (!$perm || !$perm->isDocEditor()) {
 			$this->setPermissionDeniedError();
@@ -321,8 +323,6 @@
 				$this->setError(_('DocumentGroup: Invalid Document Directory parent ID'));
 				return false;
 			}
-		} else {
-			$parent_doc_group = 0;
 		}
 
 		$res=db_query_params('SELECT * FROM doc_groups WHERE groupname=$1 AND parent_doc_group=$2 AND group_id=$3',
@@ -429,7 +429,23 @@
 		return false;
 	}
 
+
 	/**
+	 * getPath - return the complete_path
+	 *
+	 * @return	string	the complete_path
+	 * @access	public
+	 */
+	function getPath() {
+		$returnPath = '';
+		if ($this->getParentID()) {
+			$parentDg = new DocumentGroup($this->Group,$this->getParentID());
+			$returnPath = $parentDg->getPath();
+		}
+		return $returnPath.'/'.$this->getName();
+	}
+
+	/**
 	 * setStateID - set the state id of this document group
 	 *
 	 * @param	int	State ID




More information about the Fusionforge-commits mailing list