56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
namespace participo;
|
|
|
|
$basePath = "/users/cwsvjudo/www";
|
|
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
|
|
require_once($basePath."/config/cwsvJudo.config.php");
|
|
|
|
class user{
|
|
public $id;
|
|
public $loginName;
|
|
public $name;
|
|
public $vorname;
|
|
public $gebDatum;
|
|
public $eMail;
|
|
|
|
/// Setzen aller Attribute
|
|
/// @todo Inputvalidation
|
|
function set($userData){
|
|
$this->id = $userData["id"];
|
|
$this->loginName = $userData["loginName"];
|
|
$this->name = $userData["name"];
|
|
$this->vorname = $userData["vorname"];
|
|
$this->gebDatum = $userData["gebDatum"];
|
|
$this->eMail = $userData["eMail"];
|
|
return;
|
|
}
|
|
function toAssoc(){
|
|
return array(
|
|
"id" => $this->id,
|
|
"loginName"=> $this->loginName,
|
|
"name" => $this->name,
|
|
"vorname" => $this->vorname,
|
|
"gebDatum" => $this->gebDatum,
|
|
"eMail" => $this->eMail);
|
|
}
|
|
function loadFromDb($dbConn, $id){
|
|
$this->set(
|
|
loadUserDataFromDb($dbConn, $id)
|
|
);
|
|
}
|
|
}
|
|
|
|
/// request user from db via id
|
|
/// return user as assoziative array
|
|
function loadUserDataFromDb($dbConn, $userId){
|
|
return
|
|
dbQuery(
|
|
$dbConn,
|
|
"SELECT * FROM `wkParticipo_Users` WHERE id = :userId;",
|
|
array(
|
|
":userId"=>array('value'=>(int)$userId, 'data_type'=>\PDO::PARAM_INT)
|
|
)
|
|
)[0];
|
|
}
|
|
?>
|