commit
3c93d6e282
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
class CtrlUser{
|
||||
function __construct(){
|
||||
$rep=__DIR__.'/../';
|
||||
|
||||
$dVueErreur = array ();
|
||||
try{
|
||||
$action=$_REQUEST['action'];
|
||||
|
||||
switch($action) {
|
||||
case NULL:
|
||||
$this->Reinit();
|
||||
break;
|
||||
case "validationFormulaire":
|
||||
$this->ValidationFormulaire($dVueEreur);
|
||||
break;
|
||||
//mauvaise action
|
||||
default:
|
||||
$dVueEreur[] = "Erreur d'appel php";
|
||||
require ($rep.$vues['vuephp1']);
|
||||
break;
|
||||
}
|
||||
} catch (PDOException $e)
|
||||
{
|
||||
//si erreur BD, pas le cas ici
|
||||
$dVueEreur[] = "Erreur inattendue!!! ";
|
||||
require ($rep.$vues['erreur']);
|
||||
}
|
||||
catch (Exception $e2)
|
||||
{
|
||||
$dVueEreur[] = "Erreur inattendue!!! ";
|
||||
require ($rep.$vues['erreur']);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,45 +1,63 @@
|
||||
<?php
|
||||
require_once("../model/TaskModel.php");
|
||||
|
||||
class UserCtrl
|
||||
{
|
||||
private $model;
|
||||
private $view;
|
||||
private $con;
|
||||
private $taskModel;
|
||||
private $userModel;
|
||||
|
||||
public function __construct(Connection $con){
|
||||
$this->con = $con;
|
||||
$this->model = new UserModel($this->con);
|
||||
try{
|
||||
$action=$_REQUEST['action'];
|
||||
switch($action){
|
||||
|
||||
// voir les listes privees
|
||||
case 'voir_liste_priv':
|
||||
$this->loadListePriv();
|
||||
break;
|
||||
|
||||
// ajouter une liste privee
|
||||
case 'creer_liste_priv':
|
||||
$this->newListPrivate();
|
||||
break;
|
||||
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
require("../view/erreur.php");
|
||||
}
|
||||
$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;
|
||||
|
||||
// }
|
||||
// } 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();
|
||||
$TabList = $this->taskModel->loadPrivateLists($_SESSION['login']);
|
||||
require("../view/liste.php");
|
||||
}
|
||||
|
||||
public function newListPrivate(){
|
||||
$nom=$_POST['listeNom'];
|
||||
insertL(new ListTask(0, $nom, $_SESSION['login']));
|
||||
// $nom = "New List";
|
||||
$this->taskModel->addList($nom,$_SESSION['login']);
|
||||
}
|
||||
|
||||
function loadHome(){
|
||||
$user = false;
|
||||
$public_lists = $this->taskModel->loadPublicLists();
|
||||
require("../view/home.php");
|
||||
}
|
||||
|
||||
public function deconnexion(){
|
||||
$usrModel->deconnexion();
|
||||
loadHome();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
require(__DIR__.'/config/config.php');
|
||||
require(__DIR__.'/controller/FrontCtrl.php');
|
||||
require_once("config/config.php");
|
||||
require_once("controller/FrontCtrl.php");
|
||||
|
||||
$fc = new FrontCtrl($con);
|
||||
|
||||
$front = new FrontController($con);
|
||||
?>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
static $user = 'nifranco';
|
||||
static $pass = 'achanger';
|
||||
static $user = 'anboudoul';
|
||||
static $pass = 'mdpMYSQL';
|
||||
?>
|
||||
|
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<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>
|
||||
<body>
|
||||
<section class="vh-100" style="background-color: #eee;">
|
||||
<div class="container py-5 h-100">
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
<div class="col col-lg-9 col-xl-7">
|
||||
<div class="card rounded-3"><div class="card rounded-3">
|
||||
<div class="card-body p-4">
|
||||
|
||||
<h4 class="text-center my-3 pb-3">My List</h4>
|
||||
<form class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2">
|
||||
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">New task 📝</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<table class="table mb-4">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Task</th>
|
||||
<th scope="col">Importance</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($TabTask as $task){
|
||||
echo '<tr>
|
||||
<td scope="col">'.$task->get_titre().'</td>
|
||||
<td scope="col">'.$task->get_priorite().'</td>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-success ms-1">Done</button>
|
||||
<button type="submit" class="btn btn-danger">🗑</button>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue