You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
<?php
|
|
|
|
class VisiteurModel {
|
|
private $gtwUsr;
|
|
private $gtwListe;
|
|
|
|
public function __construct() {
|
|
$co = new Connection();
|
|
$this->gtwUsr = new UserGateway($co);
|
|
$this->gtwListe = new ListeGateway($co);
|
|
}
|
|
|
|
public function get_gtwUsr(): UserGateway {
|
|
return $this->gtwUsr;
|
|
}
|
|
|
|
public function get_gtwListe(): ListeGateway {
|
|
return $this->gtwListe;
|
|
}
|
|
|
|
public function connexion($login, $mdp){
|
|
$results = $this->get_gtwUsr()->getUtilisateurbyNameAndPassword($login, $mdp);
|
|
if ($results != NULL){
|
|
$_SESSION['role'] = 'user';
|
|
$_SESSION['login'] = $login;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function inscription($login, $mdp){
|
|
$this->get_gtwUsr()->creerUtilisateur($login, $mdp);
|
|
}
|
|
|
|
public function creerListe($nom) {
|
|
$this->get_gtwListe()->creerListe($nom, NULL);
|
|
}
|
|
|
|
public function supprListe($id) {
|
|
$this->get_gtwListe()->delListe($id);
|
|
}
|
|
|
|
public function creerTache(string $intitule){
|
|
$this->get_gtwListe()->creerTache($intitule);
|
|
}
|
|
}
|
|
|
|
?> |