[Fusionforge-commits] r8495 - in trunk/gforge: common/include www/include

Alexandre Neymann neymanna at libremir.placard.fr.eu.org
Thu Dec 10 14:05:05 CET 2009


Author: neymanna
Date: 2009-12-10 14:05:05 +0100 (Thu, 10 Dec 2009)
New Revision: 8495

Modified:
   trunk/gforge/common/include/Group.class.php
   trunk/gforge/www/include/project_home.php
Log:
get the number of member of a project readable

Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php	2009-12-10 13:05:04 UTC (rev 8494)
+++ trunk/gforge/common/include/Group.class.php	2009-12-10 13:05:05 UTC (rev 8495)
@@ -2427,7 +2427,7 @@
 		$roles_group_res = db_query_params ('SELECT role_id FROM role WHERE group_id=$1',
 					array ($this->getID()));
 		if (!$roles_group_res) {
-			$this->setError('Error: Roles from group id '. $this->Group->getID() . ' ' .db_error());
+			$this->setError('Error: Roles from group id '. $this->getID() . ' ' .db_error());
 			return false;
 		} else {
 		for ($i=0; $i<db_numrows($roles_group_res); $i++) {
@@ -2492,6 +2492,28 @@
 		}
 	}
 	
+	/**
+	 *	getUsers - Get the users of a group
+	 *
+	 *	@return array of user's objects.
+	 */
+	function getUsers() {
+		$users = Array();
+		
+		$users_group_res = db_query_params ('SELECT u.user_id FROM users u, user_group ug WHERE ug.group_id=$1 AND ug.user_id=u.user_id AND u.status=$2',
+					array ($this->getID(),
+					'A'));
+		if (!$users_group_res) {
+			$this->setError('Error: Enable to get users from group '. $this->getID() . ' ' .db_error());
+			return false;
+		}
+		
+		for ($i=0; $i<db_numrows($users_group_res); $i++) {
+			$users[$i] = new GFUser(db_result($users_group_res,$i,'user_id'),false);
+		}
+		
+		return $users;
+	}
 
 }
 

Modified: trunk/gforge/www/include/project_home.php
===================================================================
--- trunk/gforge/www/include/project_home.php	2009-12-10 13:05:04 UTC (rev 8494)
+++ trunk/gforge/www/include/project_home.php	2009-12-10 13:05:05 UTC (rev 8495)
@@ -157,7 +157,9 @@
 
 ?>
 
-<p><?php echo util_make_link ('/project/memberlist.php?group_id='.$group_id,'['._('View Members').']'); ?></p>
+<p><?php 
+	$members = $project->getUsers();
+	echo util_make_link ('/project/memberlist.php?group_id='.$group_id,'['.sprintf(_('View the %1$d Member(s)'),count($members)).']'); ?></p>
 
 <?php
 




More information about the Fusionforge-commits mailing list