Added page for setting and removing user attributes
This commit is contained in:
53
homepage/wkParticipo/lib/wkParticipo-user.php
Normal file
53
homepage/wkParticipo/lib/wkParticipo-user.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user