[Mapbender-commits] r5908 - branches/3_dev/core/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Apr 11 06:36:07 EDT 2010


Author: verenadiewald
Date: 2010-04-11 06:36:07 -0400 (Sun, 11 Apr 2010)
New Revision: 5908

Modified:
   branches/3_dev/core/lib/class_User.php
Log:
new fields in class + method to send email to mb_user

Modified: branches/3_dev/core/lib/class_User.php
===================================================================
--- branches/3_dev/core/lib/class_User.php	2010-04-11 10:32:24 UTC (rev 5907)
+++ branches/3_dev/core/lib/class_User.php	2010-04-11 10:36:07 UTC (rev 5908)
@@ -7,6 +7,7 @@
 
 require_once dirname(__FILE__)."/../../conf/mapbender.conf";
 require_once dirname(__FILE__)."/class_RPCEndpoint.php";
+require_once(dirname(__FILE__)."/class_Administration.php");
 
 /**
  * A Mapbender user as described in the table mb_user.
@@ -34,7 +35,15 @@
 	var $postalCode;
 	var $country ="";
 	var $url ="";
-
+	var $realName = "";
+	var $street = "";
+	var $houseNumber = "";
+	var $reference = "";
+	var $forAttentionOf = "";
+  	var $validFrom = "";
+  	var $validTo = "";
+  	var $passwordTicket = "";
+  
     static $displayName = "User";
     static $internalName = "user";
 	
@@ -118,8 +127,15 @@
 							"city" => $this->city,	
 							"postalCode" => $this->postalCode,	
 							"country" => $this->country,	
-							"url" => $this->url	
-
+							"url" => $this->url,
+        					"realName" => $this->realName,
+        					"street" => $this->street,
+        					"housenumber" => $this->housenumber,	
+        					"reference" => $this->reference,
+        					"forAttentionOf" => $this->forAttentionOf,
+        					"validFrom" => $this->validFrom,
+        					"validTo" => $this->validTo,
+        					"passwordTicket" => $this->passwordTicket
         );
 		return $result;
 	}
@@ -212,6 +228,14 @@
 		$this->country = $changes->country ? $changes->country : $this->country;
 		$this->url = $changes->url ? $changes->url : $this->url;
 		$this->id = $changes->id ? $changes->id : $this->id;
+		$this->realName = $changes->realName ? $changes->realName : $this->realName;
+		$this->street = $changes->street ? $changes->street : $this->street;
+		$this->houseNumber = $changes->houseNumber ? $changes->houseNumber : $this->houseNumber;
+		$this->reference = $changes->reference ? $changes->reference : $this->reference;
+		$this->forAttentionOf = $changes->forAttentionOf ? $changes->forAttentionOf : $this->forAttentionOf;
+		$this->validFrom = $changes->validFrom ? $changes->validFrom : $this->validFrom;
+		$this->validTo = $changes->validTo ? $changes->validTo : $this->validTo;
+		$this->passwordTicket = $changes->passwordTicket ? $changes->passwordTicket : $this->passwordTicket;
 
         return true;
 	}
@@ -235,6 +259,14 @@
 			"mb_user_postal_code = $14, ".
 			"mb_user_country = $15, ".
 			"mb_user_online_resource = $16 ".
+		 	"mb_user_realname = $18 ".
+			"mb_user_street = $19 ".
+			"mb_user_housenumber = $20 ".
+			"mb_user_reference =$21 ".
+			"mb_user_for_attention_of = $22 ".
+			"mb_user_valid_from = $23 ".
+			"mb_user_valid_to = $24 ".
+			"mb_user_password_ticket = $25 ".
 			"WHERE mb_user_id = $17;";
 
 
@@ -254,9 +286,17 @@
 									$this->postalCode,
 									$this->country,
 									$this->url,
-									$this->id);
+									$this->id,
+									$this->realName,
+		        					$this->street,
+		        					$this->housenumber,	
+		        					$this->reference,
+		        					$this->forAttentionOf,
+		        					$this->validFrom,
+		        					$this->validTo,
+        							$this->passwordTicket);
 
-			$t = array("s", "i", "s", "s", "s", "s", "i",  "s", "s",  "s", "s", "s",  "s", "i",  "s", "s", "i");
+			$t = array("s", "i", "s", "s", "s", "s", "i",  "s", "s",  "s", "s", "s",  "s", "i",  "s", "s", "i", "s", "s", "s", "s", "s", "s", "s", "s");
 
 			$update_result = db_prep_query($sql_update,$v,$t);
 			if(!$update_result)
@@ -305,8 +345,16 @@
 			$this->postalCode = $row['mb_user_postal_code'];
 			$this->country = $row['mb_user_country'];
 			$this->url = $row['mb_user_online_resource'];
-
-		}else{
+			$this->realName = $row['mb_user_realname'];
+        	$this->street = $row['mb_user_street'];
+        	$this->housenumber = $row['mb_user_housenumber'];	
+        	$this->reference = $row['mb_user_reference'];
+        	$this->forAttentionOf = $row['mb_user_for_attention_of'];
+        	$this->validFrom = $row['mb_user_valid_from'];
+        	$this->validTo = $row['mb_user_valid_to'];
+        	$this->passwordTicket = $row['mb_user_password_ticket'];
+		}
+		else {
 			 throw new Exception("no such User");
 		}
 		return true;
@@ -369,7 +417,27 @@
 		}
 		return true;
 	}
-  
+	
+	public function sendUserLoginMail () {
+		$admin = new administration();
+		
+		$userMessage = "Your Mapbender login data:\n";
+		$userMessage .= "Your login name is: ".$this->name."\n";
+		$userMessage .= "Please set your password using the following link: \n";
+		$mbUrl = substr(LOGIN, 0, -9);
+		$userMessage .= $mbUrl."../javascripts/mod_confirmLogin.php?user_id=".$this->id."&user_name=".$this->name."&user_ticket=".$this->passwordTicket."\n";
+		$userMessage .= "Follow this link to login to Mapbender: \n";
+		$userMessage .= LOGIN."\n";
+		
+		$userMail = $admin->getEmailByUserId($this->id);
+		if(!$admin->sendEmail("", "", $userMail, $this->name, utf8_decode("Your Mapbender account"), utf8_decode($userMessage), $error_msg)) {
+			return "Registry data could not be send. Please check mail address.";
+		}
+		else {
+			return "Registry data has been sent successfully.";
+		}
+	}
+	
     /*
     * @return Array of Users
     * @param $filter UNUSED! string that must be contained in the username



More information about the Mapbender_commits mailing list