|
|
|
@ -27,6 +27,26 @@ class VisitorController {
|
|
|
|
|
$this->Inscription($login, $mdp);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "supprimerListe":
|
|
|
|
|
$this->DelList();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "modifierListe":
|
|
|
|
|
$this->UpdateList();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "ajouterTache":
|
|
|
|
|
$this->AddTask();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "supprimerTache":
|
|
|
|
|
$this->DelTask();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "modifierTache":
|
|
|
|
|
$this->UpdateTask();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
$dVueEreur[] = "Erreur d'appel php";
|
|
|
|
|
require ($rep.$vues['accueil']);
|
|
|
|
@ -42,24 +62,24 @@ class VisitorController {
|
|
|
|
|
$model = new MdlListe();
|
|
|
|
|
$dataView = $model->getPublicList();
|
|
|
|
|
require($rep.$vues['accueil']);
|
|
|
|
|
$vues_erreur= array();
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function Inscription(array $vues_erreur){
|
|
|
|
|
public function Inscription(array $dVueEreur){
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$username=$_POST['username'];
|
|
|
|
|
$password=$_POST['password'];
|
|
|
|
|
$confirm=$_POST['passwordconf'];
|
|
|
|
|
$model = new MdlUser();
|
|
|
|
|
$vues_erreur=Validation::val_inscription($username,$password,$confirm,$vues_erreur);
|
|
|
|
|
$dVueEreur=Validation::val_inscription($username,$password,$confirm,$dVueEreur);
|
|
|
|
|
if($model->existUser($username)){
|
|
|
|
|
$vues_erreur[]="Username already taken";
|
|
|
|
|
$dVueEreur[]="Username already taken";
|
|
|
|
|
}
|
|
|
|
|
if(empty($vues_erreur)){
|
|
|
|
|
if(empty($dVueEreur)){
|
|
|
|
|
$hash= password_hash($password,PASSWORD_DEFAULT);
|
|
|
|
|
$model->singUp($username,$hash);
|
|
|
|
|
$vues_erreur= array();
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
require($rep.$vues['singUp']);
|
|
|
|
@ -69,12 +89,12 @@ class VisitorController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function Connexion(array $vues_erreur){
|
|
|
|
|
public function Connexion(array $dVueEreur){
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$username=$_POST['login'];
|
|
|
|
|
$password=$_POST['mdp'];
|
|
|
|
|
$vues_erreur=Validation::val_connexion($username,$password,$vues_erreur);
|
|
|
|
|
if(!empty($vues_erreur)){
|
|
|
|
|
$dVueEreur=Validation::val_connexion($username,$password,$dVueEreur);
|
|
|
|
|
if(!empty($dVueEreur)){
|
|
|
|
|
require($rep.$vues['signIn']);
|
|
|
|
|
}
|
|
|
|
|
$model= new MdlUser();
|
|
|
|
@ -83,17 +103,92 @@ class VisitorController {
|
|
|
|
|
$model->connexion($username);
|
|
|
|
|
$_REQUEST['action']=null;
|
|
|
|
|
$this->reinit();
|
|
|
|
|
$vues_erreur= array();
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$vues_erreur =array('username'=>$username,'password'=>$password);
|
|
|
|
|
$dVueEreur =array('username'=>$username,'password'=>$password);
|
|
|
|
|
require($rep.$vues['signIn']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$vues_erreur =array('username'=>$usrname,'password'=>$pwd);
|
|
|
|
|
$dVueEreur =array('username'=>$usrname,'password'=>$pwd);
|
|
|
|
|
require($rep.$vues['signIn']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DelList($dVueEreur) {
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
$idListe=$_POST['liste'];
|
|
|
|
|
$name=$_POST['name'];
|
|
|
|
|
$private=$_POST['private'];
|
|
|
|
|
$model = new MdlListe();
|
|
|
|
|
$model->delete($idListe, $name, $private);
|
|
|
|
|
$_REQUEST['action']=null;
|
|
|
|
|
$this->reinit();
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function UpdateList($dVueEreur) {
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
$idListe=$_POST['liste'];
|
|
|
|
|
$name=$_POST['name'];
|
|
|
|
|
$private=$_POST['private'];
|
|
|
|
|
$model = new MdlListe();
|
|
|
|
|
$model->update($idListe, $name, $private);
|
|
|
|
|
$_REQUEST['action']=null;
|
|
|
|
|
$this->reinit();
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function AddTask($dVueEreur) {
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$nom=$_POST['name'];
|
|
|
|
|
$idListe=$_POST['liste'];
|
|
|
|
|
$content=$_POST['content'];
|
|
|
|
|
$completed=$_POST['completed'];
|
|
|
|
|
$dVueEreur = Validation::val_intitule($nom, $dVueEreur);
|
|
|
|
|
if(!empty($dVueEreur)){
|
|
|
|
|
require($rep.$vues['addTask']);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$model = new MdlTache();
|
|
|
|
|
$model->insert($nom, $content, $completed, $idListe);
|
|
|
|
|
$_REQUEST['action']="accessListInfos";
|
|
|
|
|
$this->accessListInfos($dVueEreur);
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function accessListInfos($dVueEreur){
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$idListe=$_POST['liste'];
|
|
|
|
|
$model = new MdlListe();
|
|
|
|
|
$dataView = $model->findById($idListe);
|
|
|
|
|
require($rep.$vues['seeList']);
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DelTask($dVueEreur) {
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$idTache=$_POST['tache'];
|
|
|
|
|
$model= new MdlTache();
|
|
|
|
|
$model->delete($idTache);
|
|
|
|
|
$_REQUEST['action']="accessListInfos";
|
|
|
|
|
$this->accessListInfos($dVueEreur);
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function UpdateTask($dVueEreur) {
|
|
|
|
|
global $rep,$vues,$dataView;
|
|
|
|
|
$idTache=$_POST['tache'];
|
|
|
|
|
$name=$_POST['name'];
|
|
|
|
|
$content=$_POST['content'];
|
|
|
|
|
$completed=$_POST['completed'];
|
|
|
|
|
$model = new MdlTache();
|
|
|
|
|
$model->update($idTache, $name, $content, $completed);
|
|
|
|
|
$_REQUEST['action']="accessListInfos";
|
|
|
|
|
$this->accessListInfos($dVueEreur);
|
|
|
|
|
$dVueEreur= array();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|