commit
b501e081f2
@ -1,56 +1,45 @@
|
||||
<?php
|
||||
class CtrlUser
|
||||
class UserCtrl
|
||||
{
|
||||
private $model;
|
||||
private $view;
|
||||
private $con;
|
||||
|
||||
public function __construct(TaskModel $model, HomeView $view,
|
||||
Connection $con){
|
||||
session_start();
|
||||
|
||||
$this->model = $model;
|
||||
$this->view = $view;
|
||||
public function __construct(Connection $con){
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function handleAction(){
|
||||
$this->model = new UserModel($this->con);
|
||||
try{
|
||||
$action=$_REQUEST['action'];
|
||||
switch($action){
|
||||
// pas d'action afficher la home page avec toutes les listes
|
||||
case NULL:
|
||||
$this->home();
|
||||
break;
|
||||
|
||||
// ajouter une liste publique
|
||||
case 'creer_liste_pub':
|
||||
$this->newList('private');
|
||||
// voir les listes privees
|
||||
case 'voir_liste_priv':
|
||||
$this->loadListePriv();
|
||||
break;
|
||||
|
||||
// ajouter une liste privee
|
||||
case 'creer_liste_priv':
|
||||
$this->newList('public');
|
||||
break;
|
||||
|
||||
// supprimer une liste
|
||||
case 'supprimer_liste':
|
||||
$this->delList();
|
||||
break;
|
||||
|
||||
// changer nom de la liste
|
||||
case 'changer_nom':
|
||||
$this->changeListName();
|
||||
$this->newListPrivate();
|
||||
break;
|
||||
|
||||
// ajouter une tache
|
||||
|
||||
// completer tache
|
||||
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
require("../view/erreur.php");
|
||||
}
|
||||
}
|
||||
|
||||
public function loadListePriv(){
|
||||
$name = "Liste privée";
|
||||
$TabList = array();
|
||||
// $TabList[] = new ListTask(0, "Projet PHP");
|
||||
// $TabList[] = new ListTask(1, "Projet Blazor");
|
||||
$TabListPriv = $this->model->getPrivateList();
|
||||
require("../view/liste.php");
|
||||
}
|
||||
|
||||
public function newListPrivate(){
|
||||
$nom=$_POST['listeNom'];
|
||||
insertL(new ListTask(0, $nom, $_SESSION['login']));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
echo '<head>
|
||||
<meta charset="utf-8" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
|
||||
crossorigin="anonymous">
|
||||
</head>';
|
||||
echo '<h1>'.$name.'</h1><center>';
|
||||
echo '<div class="list-group list-group-light">';
|
||||
foreach($TabList as $liste){
|
||||
echo '<button type="button" class="list-group-item list-group-item-action px-3 border-0">'.$liste->get_nom().'</button>';
|
||||
}
|
||||
echo '</div></center>';
|
||||
?>
|
Loading…
Reference in new issue