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.
70 lines
1.9 KiB
70 lines
1.9 KiB
<?php
|
|
require_once("../model/TaskModel.php");
|
|
|
|
class UserCtrl
|
|
{
|
|
private $view;
|
|
private $con;
|
|
private $taskModel;
|
|
private $userModel;
|
|
private $TabVues;
|
|
|
|
public function __construct(Connection $con, $TabVues){
|
|
$this->TabVues = $TabVues;
|
|
$this->con = $con;
|
|
$this->userModel = new UserModel($this->con);
|
|
$this->taskModel = new TaskModel($this->con);
|
|
try{
|
|
$action=$_REQUEST['action'];
|
|
switch($action){
|
|
|
|
// voir les listes privees
|
|
case 'voirListePriv':
|
|
$this->loadListePriv();
|
|
break;
|
|
|
|
// ajouter une liste privee
|
|
case 'creerListePriv':
|
|
$this->newListPrivate();
|
|
break;
|
|
case 'deconnecter':
|
|
$this->deconnexion();
|
|
break;
|
|
default:
|
|
$TMessage[] = 'Unexpected error';
|
|
require($this->TabVues["erreur"]);
|
|
break;
|
|
|
|
}
|
|
} catch(Exception $e) {
|
|
require($this->TabVues["erreur"]);
|
|
}
|
|
}
|
|
|
|
public function loadListePriv(){
|
|
$name = "Liste privée";
|
|
// $TabList[] = new ListTask(0, "Projet PHP");
|
|
// $TabList[] = new ListTask(1, "Projet Blazor");
|
|
$TabList = $this->taskModel->loadPrivateLists($_SESSION['login']);
|
|
require($this->TabVues["liste"]);
|
|
}
|
|
|
|
public function newListPrivate(){
|
|
$nom=$_POST['listeNom'];
|
|
// $nom = "New List";
|
|
$this->taskModel->addList($nom,$_SESSION['login']);
|
|
}
|
|
|
|
function loadHome(){
|
|
$user = false;
|
|
$public_lists = $this->taskModel->loadPublicLists();
|
|
require($this->TabVues["home"]);
|
|
}
|
|
|
|
public function deconnexion(){
|
|
$usrModel->deconnexion();
|
|
loadHome();
|
|
}
|
|
}
|
|
?>
|