[Mapbender-commits] r6477 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jul 1 06:19:03 EDT 2010


Author: christoph
Date: 2010-07-01 10:19:03 +0000 (Thu, 01 Jul 2010)
New Revision: 6477

Modified:
   trunk/mapbender/http/classes/class_group.php
Log:
added group metadata

Modified: trunk/mapbender/http/classes/class_group.php
===================================================================
--- trunk/mapbender/http/classes/class_group.php	2010-07-01 09:54:51 UTC (rev 6476)
+++ trunk/mapbender/http/classes/class_group.php	2010-07-01 10:19:03 UTC (rev 6477)
@@ -28,10 +28,20 @@
 	/**
 	 * @var Integer The Group ID
 	 */
-	var $id;
+	private $id;
 	var $name;
 	var $owner = 0;
 	var $description ="";
+	var $title;
+	var $address;
+	var $postcode;
+	var $city;
+	var $stateorprovince;
+	var $country;
+	var $voicetelephone;
+	var $facsimiletelephone;
+	var $email;
+	var $logo_path;	
 
     static $displayName = "Group";
     static $internalName = "group";
@@ -171,6 +181,17 @@
 		return true;
 	}
 
+	public function exists () {
+		$sql_group = "SELECT group_id from mb_group WHERE mb_group_id = $1; ";
+		$v = array($this->id);
+		$t = array("i");
+		$res_group = db_prep_query($sql_group,$v,$t);
+		if ($row = db_fetch_array($res_group)) {
+			return true;
+		}
+		return false;
+	}
+
 	public function load() {
 		$sql_group = "SELECT * from mb_group WHERE mb_group_id = $1; ";
 		$v = array($this->id);
@@ -184,10 +205,20 @@
             $tmpuser =  new User($row['mb_group_owner']);
             $this->owner = $tmpuser->name;
             $this->description	= $row['mb_group_description'];
-
+            $this->title = $row["mb_group_title"];
+            $this->address = $row["mb_group_address"];
+            $this->postcode = $row["mb_group_postcode"];
+            $this->city = $row["mb_group_city"];
+            $this->stateorprovince = $row["mb_group_stateorprovince"];
+            $this->country = $row["mb_group_country"];
+            $this->voicetelephone = $row["mb_group_voicetelephone"];
+            $this->facsimiletelephone = $row["mb_group_facsimiletelephone"];
+            $this->email = $row["mb_group_email"];
+            $this->logo_path = $row["mb_group_logo_path"];	
 		}
 		else{
 			 throw new Exception("Group with ID " . $this->id . " does not exist.");
+			 return false;
 		}
 		return true;
 	}
@@ -253,6 +284,20 @@
 		return false;
 	}
 	
+	public static function getGroupsByUser ($id) {
+		$user = new User($id);
+		if (!$user->isValid()) {
+			new mb_exception("User ID " . $id . " invalid.");
+			return array();		
+		}
+		$groups = $user->getGroupsByUser();
+		if (!is_array($groups)) {
+			new mb_notice("User " . $id . " is not member in any group.");
+			return array();
+		}
+		return $groups;
+	}
+	
 	public function getUser () {
 		if (!$this->isValid()) {
 			return array();



More information about the Mapbender_commits mailing list