class_Account.inc.php 20.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536
<?php
/**
 * @file	Account.inc.php
 * @category freeSN
 * @mailto	code [at] netz.coop
 * @version 0.4.200901
 * @link http://netz.coop
 * 
 *  @copyright Copyright by netz.coop e.G. 2015
 *  
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 *	Diese Klasse ist ein Account (Benutzerkonto)
 *		Jeder Mensch (im Portal) hat ein Account, welches eindeutig ist (Personalausweisdaten)
 *		 mit diesem Account kann mensch sich ein Profil erstellen,
 *		also Account hat ein @see Profil
 *
 *	@version 		0.1.071229
 *	@author			dev [at] mensch [dot] coop
 */
class Account extends BasisElement {

	private		$Loaded			= FALSE;
	protected	$FirstName		= FALSE;
	protected 	$SurName		= FALSE;
	protected 	$EMail			= FALSE;
	private 	$Birthday		= FALSE;
	protected 	$Street			= FALSE;
	protected 	$Streetnumber	= FALSE;
	protected 	$City			= FALSE;
	protected 	$ZipCode		= FALSE;
	private 	$Password		= FALSE;
	protected	$XMLTag			= 'account';
	private		$Authenticated	= FALSE;

	/**
	 * main profile id which is in the database table losp_be_account
	 * @var int
	 */
	protected $ProfileID = 0;

	/**
	 *
	 * @var Profile main profile which id (ProfileID) is in the database table losp_be_account
	 */
	private $MainProfile = NULL;

	/**
	 * active profile, which the user choose .. normaly the main profile
	 * @var Profile
	 */
	private $ActiveProfile = NULL;

	/**
	 * ActiveProfileID
	 * @var int
	 */
	private $ActiveProfileID = NULL;

	/**
	 *	initial with 0 it's means anonym
	 */
	private $AuthorProfileID = 0;

	/**
	 * function return $AuthorProfileID
	 *
	 * @return int $AuthorprofileID
	 */
	public function getAuthorProfileID(){
		return $this->AuthorProfileID;
	}
	/**
	 * function sets $AuthorProfileID
	 *
	 * @param int $param_AuthorProfileID
	 */
	public function setAuthorProfileID($param_AuthorProfileID){
		if(array_key_exists($param_AuthorProfileID,$this->PossibleProfileIDArray)){
			$this->AuthorProfileID = $param_AuthorProfileID;
		}
	}
	/**
	 * function reset the $AutorProfileID to the $ActiveProfileID
	 */
	public function resetAuthorProfileID(){
		$this->AuthorProfileID = $this->ActiveProfileID;
	}
	public function createProfile(iStorable &$param_iStorable, $param_Data){

		if($this->MainProfile){
			return Error::newError('Error',"Es existiert schon ein MainProfile","");
		} else {
			$this->MainProfile = BasisElement::makeNewObject($this, $param_iStorable, 'Profile', $param_Data);
			if($this->MainProfile){
				if($this->saveObject($this, $param_iStorable)) {
					$this->ActiveProfile &= $this->MainProfile;
					return $this->MainProfile;
				} else return Error::newError('',"Das Verlinken von Account ".$this->ID." und MainProfile hat nicht geklappt","");
			} else return Error::newError('',"Das Erstellen des Profil für den Account ".$this->ID." ist fehlgeschlagen","");
		}
	}

	/**
	 * function set active profile ..... the surf profile
	 */
	public static function setActiveProfile(Account &$param_HostAccount, iStorable &$param_iStorable, $param_ProfileID) {

		$param_HostAccount->ActiveProfileID = $param_ProfileID;
		$param_HostAccount->ActiveProfile =& MultimediaText::loadElement($param_HostAccount, $param_iStorable, 'Profile', $param_HostAccount->ActiveProfileID);

		$param_HostAccount->AuthorProfileID = $param_ProfileID;

		$param_HostAccount->loadActiveProfileSwitchBC($param_iStorable);
		$param_HostAccount->setRequestProfileID($param_ProfileID);

		$param_HostAccount->ActiveProfile->setObjVar('RequestProfileID', $param_ProfileID);
		if($param_HostAccount->getMainProfile()) {
			$param_HostAccount->getMainProfile()->setOnlineState(1);
		}
	}

	/**
	 *	return the active profile
	 *	@return Profile
	 */
	public function &getActiveProfile() {
		return $this->ActiveProfile;
	}

	/**
	 *	gibt die ID zurück vom ausgewählten aktiven Profil
	 *	@return int
	 */
	public function getActiveProfileID(){
		return $this->ActiveProfileID;
	}



	private $ActiveProfileSwitchBC = array();
	private function loadActiveProfileSwitchBC(iStorable &$param_iStorable) {
		$var_IdentityManagement = CONFIG::getIdentityManagement();
//D::show($var_IdentityManagement, '$var_IdentityManagement',1,1)		;
		foreach($var_IdentityManagement['SwitchProfiles']['BasisClipboards'] as $var_BCNAme => $values) {
			$this->ActiveProfileSwitchBC[$var_BCNAme] = &$this->MainProfile->getClipboard($this, $param_iStorable, $var_BCNAme);
			$this->MainProfile->loadClipboard($this, $param_iStorable, $var_BCNAme, null, array('limit' => $values['limit']));
		}

	}

	private $ActiveAuthorProfileBC = array();
	public function loadActiveAuthorProfilehBC(iStorable &$param_iStorable) {
		$var_IdentityManagement = CONFIG::getIdentityManagement();

		foreach($var_IdentityManagement['AuthorProfiles']['BasisClipboards'] as $var_BCNAme => $values) {
//			D::li($var_BCNAme);
			$this->ActiveAuthorProfileBC[$var_BCNAme] = &$this->MainProfile->getClipboard($this, $param_iStorable, $var_BCNAme);
			$this->MainProfile->loadClipboard($this, $param_iStorable, $var_BCNAme, null, array('limit' => $values['limit']));
//			$this->ActiveAuthorProfileBC[$var_BCNAme] = &$this->MainProfile->getClipboard($this, $param_iStorable, $var_BCNAme);
		}
//D::show($this->ActiveAuthorProfileBC['GroupProfileBC']->getObjVar('AttachIDList'), 'ActiveAuthorProfileBC')		;
	}

	public function loadMainProfile(iStorable &$param_iStorable) {

		if($this->ProfileID && !$this->MainProfile) {
			$this->PossibleProfileIDArray[$this->ProfileID] = array( );
			$this->PossibleProfileIDArray[$this->ProfileID]['NickName'] = Profile::IDToNickName($param_iStorable, $this->ProfileID);
			$this->PossibleProfileIDArray[$this->ProfileID]['Avatar'] = Profile::IDToAvatar($param_iStorable, $this->ProfileID);
			$this->PossibleProfileIDArray[$this->ProfileID]['WriteRight'] = true;
			$this->MainProfile =& Profile::loadElement($this, $param_iStorable, 'Profile', $this->ProfileID);

			$this->loadActiveProfileSwitchBC($param_iStorable);
			$this->loadActiveAuthorProfilehBC($param_iStorable);
			$this->loadPossibleProfileIDArray($param_iStorable);
			/**
			 * @todo das geht ja mal gar nicht 2 mal loadActiveAuthorProfilehBC ... doch wegen dem 8.4. und es muss ne version online
			 *	100408 @f
			 */
			$this->loadActiveAuthorProfilehBC($param_iStorable);
			GlobalData::setLoggedIn();
			RETURN TRUE;
		} else {
			RETURN FALSE;
		}
	}
	/**
	 *	zusätzliche Angabe von Rechten
	 *
	 *	kann als _GET angegeben werden _GET[loadRight][BEID][BCNAME]=ProfileID1-ProfileID2-ProfileID3
	 *		stattet das BasisClipboard mit weiteren Rechten aus (siehe getPossibleProfileIDArray)
	 *
	 * @var array
	 */
	private $RightRestrictions = null;
	public function setRightRestrictions(array $param_loadRight) {
		$this->RightRestrictions = $param_loadRight;
	}

	/**
	 *	check if the param_ProfileID number is choose able (the active profile id or one of the subprofile id numbers)
	 *
	 *	@param int param_ProfileID
	 */
	public function checkIsChooseAble(iStorable &$param_iStorable, $param_ProfileID){
		if($this->ActiveProfileID===$param_ProfileID || $this->ProfileID===$param_ProfileID) {
			return true;
		}
		foreach ($this->ActiveProfileSwitchBC as $var_BC) {
			if($var_BC->get($this, $param_iStorable, $param_ProfileID)) {
				return true;
			}
		}
		return false;
	}

	private $PossibleProfileIDArray = array();
	private function loadPossibleProfileIDArray(iStorable &$param_iStorable) {

//		D::show($this->ActiveProfileSwitchBC,'ActiveProfileSwitchBC',1,1);

		foreach ($this->ActiveProfileSwitchBC as $var_BC) {
			foreach($var_BC->getObjVar('AttachIDList') as $var_id => $var_value) {
				$this->PossibleProfileIDArray[$var_id] = array(
					'NickName' => Profile::IDToNickName($param_iStorable, $var_id),
					'Avatar' => Profile::IDToAvatar($param_iStorable, $var_id),
					'Signature' => Profile::IDToSignature($param_iStorable, $var_id),
					'kindof' => 'SwitchProfiles',
					'WriteRight' => true,
					'PartOfObjVar' => $var_BC->getPartOfObjVarName(),
				);
			}
		}
		foreach ($this->ActiveAuthorProfileBC as $var_BC) {
			foreach($var_BC->getObjVar('AttachIDList') as $var_id => $var_value) {

				$this->PossibleProfileIDArray[$var_id] = array(
					'NickName' => Profile::IDToNickName($param_iStorable, $var_id),
					'Avatar' => Profile::IDToAvatar($param_iStorable, $var_id),
					'Signature' => Profile::IDToSignature($param_iStorable, $var_id),
					'PartOfObjVar' => $var_BC->getPartOfObjVarName(),
//					'AttachStateID' => $var_value[$this->MainProfile->getObjVar('ID')]['AttachStateID'],
				);

				//if Abfrage wegen Service.php nötig
				if(is_subclass_of($param_iStorable,'iBasicSql')) {
					$var_Row = $param_iStorable->BC_getRow($var_id, $this->MainProfile->getObjVar('ID'), MemberProfileBC::SQL_PARTOFOBJVARID, $param_AttachStateID=null, $param_LinkerProfileID=null, $param_CategoryID=null);

					if($var_Row){
						if($var_Row[0]['AttachStateID'] == MemberProfileBC::STATE_MASTER_ID) {
							$this->PossibleProfileIDArray[$var_id]['WriteRight'] = true;
							$this->PossibleProfileIDArray[$var_id]['kindof'] = MemberProfileBC::STATE_MASTER_NAME;
						} else if($var_Row[0]['AttachStateID'] == MemberProfileBC::STATE_AUTHOR_ID ) {
							$this->PossibleProfileIDArray[$var_id]['kindof'] = MemberProfileBC::STATE_AUTHOR_NAME;
							$this->PossibleProfileIDArray[$var_id]['WriteRight'] = false;
						} else if($var_Row[0]['AttachStateID'] == MemberProfileBC::STATE_READER_ID) {
							$this->PossibleProfileIDArray[$var_id]['kindof'] = MemberProfileBC::STATE_READER_NAME;
							$this->PossibleProfileIDArray[$var_id]['WriteRight'] = false;
						} else {
							unset($this->PossibleProfileIDArray[$var_id]);
						}
					} else {
						unset($this->PossibleProfileIDArray[$var_id]);
					}
				}
			}
		}
	}

	public function setNoLoginMainProfile(iStorable &$param_iStorable) {
		$this->ActiveProfileID = $this->ProfileID = 0;
		$this->PossibleProfileIDArray[0] = CONFIG::getConfig('noLogin');
//		$this->PossibleProfileIDArray[0] = array(
//			'NickName' => 'no login',
//			'Avatar' => 'no login',
////			'WriteRight' => false
//			'WriteRight' => true
//		);
		/**
		 *	@new 100407 @f
		 */
		// $this->ActiveProfile = Profile::createNewInstance($param_iStorable, 'Profile', $this->ActiveProfileID);
	}

	public function getPossibleProfileIDArray($param_PartOfID=null, $param_BasisClipboardName=null) {
		if($param_PartOfID===null && $param_BasisClipboardName===null) {
			return $this->PossibleProfileIDArray;
		} else if($param_PartOfID && $param_BasisClipboardName && is_array($this->RightRestrictions) && array_key_exists($param_PartOfID, $this->RightRestrictions) && array_key_exists($param_BasisClipboardName, $this->RightRestrictions[$param_PartOfID])) {
			$var_onlyThisIDArray = CONFIG::transformStringToArray($this->RightRestrictions[$param_PartOfID][$param_BasisClipboardName], 'UrlString');
			$var_result = array();
			foreach($this->PossibleProfileIDArray as $var_id => $var_values) {
				if(array_search($var_id, $var_onlyThisIDArray)!==FALSE) {
					$var_result[$var_id] = $var_values;
				}
			}
			return $var_result;
		} else {
			return $this->PossibleProfileIDArray;
		}
	}

//	public function getPossibleAuthorIDArray($param_PartOfID=null, $param_BasisClipboardName=null) {
//		D::show($this->PossibleProfileIDArray);
//			return $this->PossibleProfileIDArray;
//
//	}

	/**
	 *	Funktion gibt XML List mit den Gruppen des Profils wieder (eingeschlossen im List Tag)
	 */
	public function getSwitchProfileListDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_XMLTag=null){
		if($param_XMLTag===null) {
			$param_XMLTag = 'SwitchProfileList';
		}
		$DOMElement = $param_DOMDocument->createElement($param_XMLTag);

		$DOMElement->setAttribute('kindof', 'SwitchProfiles');


		$DOMElement_SUB = $param_DOMDocument->createElement('ShortProfile');
		$DOMElement_SUB->setAttribute('ID', $this->MainProfile->getObjVar('ID'));
		$DOMElement_SUB->setAttribute('OnlineState', $this->MainProfile->getObjVar('OnlineState'));
		$DOMElement_SUB->setAttribute('NickName', $this->MainProfile->getObjVar('NickName'));
		$DOMElement_SUB->setAttribute('Avatar', $this->MainProfile->getObjVar('Avatar'));
		$DOMElement_SUB->setAttribute('Signature', $this->MainProfile->getObjVar('Signature'));
		$DOMElement_SUB->setAttribute('IdentityManagementBasisClipboard', 'MainProfile');
		if($this->MainProfile->getObjVar('ID')==$this->ActiveProfileID) {
			$DOMElement_SUB->setAttribute('ActiveProfile', true);
		}

		/****schmuh *****/
		$query= 'select CDate from losp_BE_SREQUEST_history where MTextID=:MTextID and Action=\'Edit\' order by NumberOfAction desc limit 1';
		$binds= array(':MTextID' => $this->MainProfile->getObjVar('ID'));
		$var_stmt = $param_iStorable->PDO_query($query, $binds);
		$row = $param_iStorable->PDO_getResultRow($var_stmt);
		$DOMElement_SUB->setAttribute('lastEdit', $row['CDate']);
		/****schmuh end*****/

		$DOMElement->appendChild($DOMElement_SUB);

		foreach($this->ActiveProfileSwitchBC as $var_BCName => $var_BC) {
			foreach($var_BC->getAll($param_HostAccount, $param_iStorable) as $var_SwitchProfile) {
				$DOMElement_SUB = $param_DOMDocument->createElement('ShortProfile');
				$DOMElement_SUB->setAttribute('ID', $var_SwitchProfile->getObjVar('ID'));
				$DOMElement_SUB->setAttribute('OnlineState', $var_SwitchProfile->getObjVar('OnlineState'));
				$DOMElement_SUB->setAttribute('NickName', $var_SwitchProfile->getObjVar('NickName'));
				$DOMElement_SUB->setAttribute('Avatar', $var_SwitchProfile->getObjVar('Avatar'));
				$DOMElement_SUB->setAttribute('Signature', $var_SwitchProfile->getObjVar('Signature'));
				$DOMElement_SUB->setAttribute('IdentityManagementBasisClipboard', $var_BCName);
				if($var_SwitchProfile->getObjVar('ID')==$this->ActiveProfileID) {
					$DOMElement_SUB->setAttribute('ActiveProfile', true);
				}
				$DOMElement->appendChild($DOMElement_SUB);
			}
		}
		return $DOMElement;
	}

	public function getAuthorProfileListDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument){
		$DOMElement = $param_DOMDocument->createElement('AuthorProfileList');
		$DOMElement->setAttribute('kindof', 'AuthorProfiles');
//D::show($this->ActiveAuthorProfileBC,'$this->ActiveAuthorProfileBC',1,1);
//		D::show($this->PossibleProfileIDArray, "$this ->PossibleProfileIDArray",1,1);
		foreach($this->ActiveAuthorProfileBC as $var_BCName => $var_BC) {
			foreach($var_BC->getAll($param_HostAccount, $param_iStorable) as $var_SwitchProfile) {
				$DOMElement_SUB = $param_DOMDocument->createElement('ShortProfile');
				$DOMElement_SUB->setAttribute('ID', $var_SwitchProfile->getObjVar('ID'));
				$DOMElement_SUB->setAttribute('OnlineState', $var_SwitchProfile->getObjVar('OnlineState'));
				$DOMElement_SUB->setAttribute('NickName', $var_SwitchProfile->getObjVar('NickName'));
				$DOMElement_SUB->setAttribute('Avatar', $var_SwitchProfile->getObjVar('Avatar'));
				$DOMElement_SUB->setAttribute('Signature', $var_SwitchProfile->getObjVar('Signature'));
				$DOMElement_SUB->setAttribute('IdentityManagementBasisClipboard', $var_BCName);
				if(array_key_exists($var_SwitchProfile->getObjVar('ID'), $this->PossibleProfileIDArray)) {
					$DOMElement_SUB->setAttribute('WriteRight', $this->PossibleProfileIDArray[$var_SwitchProfile->getObjVar('ID')]['WriteRight']);
					$DOMElement_SUB->setAttribute('kindof', $this->PossibleProfileIDArray[$var_SwitchProfile->getObjVar('ID')]['kindof']);
				}
				$DOMElement->appendChild($DOMElement_SUB);
			}
		}
		return $DOMElement;
	}

	public function getObjDOMElement(Account &$param_HostAccount, iStorable &$param_iStorable, DOMDocument $param_DOMDocument, $param_KindOf=null, array $param_DOMElemente=null) {
		$DOMElement = parent::getObjDOMElement($param_HostAccount, $param_iStorable, $param_DOMDocument, $param_KindOf, $param_DOMElemente);
		$DOMElement->appendChild($param_HostAccount->getSwitchProfileListDOMElement($param_HostAccount, $param_iStorable, $param_DOMDocument));
		$DOMElement->appendChild($param_HostAccount->getAuthorProfileListDOMElement($param_HostAccount, $param_iStorable, $param_DOMDocument));
		return $DOMElement;
	}


	/**
	 *	Funktion ändert das Passwort des Accounts
	 *	@param	String	$oldPassword
	 *	@param	String	$newPassword
	 */
	public function changePassword($oldPassword, $newPassword){
		$oldPassword = self::transformPasswordToCrypt($oldPassword);
		$newPassword = self::transformPasswordToCrypt($newPassword);

		if($this->ID!=0){
			$this->DB->Account_changePassword($this->ID, $oldPassword, $newPassword);
		} else {
			return Error::newError('UserError',"Object Account hat keine ID","");
		}
	}

	/**
	 * @var boolean true if user login, false if not
	 */
	protected $LoginState=false ;

	public  function getLoginState() {
		return $this->LoginState;
	}

	public function checkPassword($User, $Password){
		$this->ID = $this->DB->Account_checkPassword($User, self::transformPasswordToCrypt($Password));
		if($this->ID) {
			$this->Authenticated = TRUE;
			return $this->ID;
		} else {
			return Error::newError("Account->checkPassword()","Password ist falsch","");
		}
	}



	public function getFormularPasswordXML($DOMDocument){
		if($this->ID!=0 && $this->Loaded){
			$DOMElement = $DOMDocument->createElement("Formular");
			$DOMElement->setAttribute('action',  $_SERVER["PHP_SELF"]);
			$account = $DOMElement->appendChild($DOMDocument->createElement("password"));

			$DescriptData = $this->DB->getTableDescript($this->ThisClassName);
			$account->appendChild($DOMDocument->createElement('Password'))->setAttribute('maxlength',$DescriptData["Password"]["Length"]);

			return $DOMElement;
		} else return Error::newError("Account->getFormularPasswordXML","Object Account hat keine ID oder ist nicht geladen","");
	}

	public function getFormularLoginXML($DOMDocument){
		$DOMElement = $DOMDocument->createElement("Formular");
		$DOMElement->setAttribute('action',  $_SERVER["PHP_SELF"]);
		$account = $DOMElement->appendChild($DOMDocument->createElement("login"));
		$DescriptData = $this->DB->getTableDescript($this->ThisClassName);
		$account->appendChild($DOMDocument->createElement('Password'))->setAttribute('maxlength',$DescriptData["Password"]["Length"]);
		$account->appendChild($DOMDocument->createElement('LoginID'));
		return $DOMElement;
	}


	public function getLoaded(){			return $this->Loaded;					}
	public function getMainProfile(){		return $this->MainProfile;					}
	public function getPassword(){			return $this->Password;					}
	public function getFirstName(){			return $this->FirstName;				}
	public function getStreet(){			return $this->Street;					}
	public function getStreetnumber(){		return $this->Streetnumber;				}
	public function getBirthday(){			return $this->Birthday;					}
	public function getCity(){				return $this->City;						}
	public function getZipCode(){			return $this->ZipCode;					}

	private static function transformPasswordToCrypt($param_Password) {
		if($param_Password) {
			return sha1($param_Password);
		} else {
			return false;
		}
	}

	public function setPassword($Password){
		$this->Password = self::transformPasswordToCrypt($Password);
	}

	/**
	 *	Funktion erstellt ein neues Objekt dieser Klasse
	 *
	 *	@static
	 *
	 *	@param	iBasicSql $param_DB
	 *	@param	Array $param_Data
	 *	@return	Account Object
	 *
	 */
	public static function &makeNew(iStorable &$param_iStorable, array $param_Data, $param_PartOf=null){
		$new = BasisElement::createNewInstance($param_iStorable, 'Account', 0, $param_PartOf);
		$new->setData($param_HostAccount, $param_iStorable, $param_Data);
		$new->setPassword($param_Data["Password"]);
		$new->createProfile($param_Data);
		$new->saveObject($new, $param_iStorable);
		return $new;
	}


	/**
	 *	Funktion lädt Objekt mit Daten aus der Datenbank
	 *
	 */
	public function loadObject(Account &$param_HostAccount, iStorable &$param_iStorable, $param_Parameter=null){
		if($this->ID!=0){
			if(parent::loadObject($param_HostAccount, $param_iStorable, $param_Parameter)) {
				$this->Loaded = TRUE;
				return $this->Loaded;
			}
		} else return Error::newError('DevUser',"Object Account hat keine ID","");
	}

	/**
	 *	Funktion speichert Objekt in die Datenbank
	 *
	 */
	public function saveObject(Account &$param_HostAccount, iStorable &$param_iStorable){
		if($this->FirstName && $this->EMail) {
			return parent::saveObject($param_HostAccount, $param_iStorable);
		} else {
			return Error::newError("","Fehler beim speicher der Daten, es existiert kein NickName ","");
		}
	}


}
?>