commit
19a7a10262
@ -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
|
<?php
|
||||||
|
require_once("../model/TaskModel.php");
|
||||||
|
|
||||||
class UserCtrl
|
class UserCtrl
|
||||||
{
|
{
|
||||||
private $model;
|
|
||||||
private $view;
|
private $view;
|
||||||
private $con;
|
private $con;
|
||||||
|
private $taskModel;
|
||||||
|
private $userModel;
|
||||||
|
|
||||||
public function __construct(Connection $con){
|
public function __construct(Connection $con){
|
||||||
$this->con = $con;
|
$this->con = $con;
|
||||||
$this->model = new UserModel($this->con);
|
$this->userModel = new UserModel($this->con);
|
||||||
try{
|
$this->taskModel = new TaskModel($this->con);
|
||||||
$action=$_REQUEST['action'];
|
// try{
|
||||||
switch($action){
|
// $action=$_REQUEST['action'];
|
||||||
|
// switch($action){
|
||||||
// voir les listes privees
|
|
||||||
case 'voir_liste_priv':
|
// // voir les listes privees
|
||||||
$this->loadListePriv();
|
// case 'voirListePriv':
|
||||||
break;
|
// $this->loadListePriv();
|
||||||
|
// break;
|
||||||
// ajouter une liste privee
|
|
||||||
case 'creer_liste_priv':
|
// // ajouter une liste privee
|
||||||
$this->newListPrivate();
|
// case 'creerListePriv':
|
||||||
break;
|
// $this->newListPrivate();
|
||||||
|
// break;
|
||||||
}
|
// case 'deconnecter':
|
||||||
} catch(Exception $e) {
|
// $this->deconnexion();
|
||||||
require("../view/erreur.php");
|
// break;
|
||||||
}
|
|
||||||
|
// }
|
||||||
|
// } catch(Exception $e) {
|
||||||
|
// require("../view/erreur.php");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadListePriv(){
|
public function loadListePriv(){
|
||||||
$name = "Liste privée";
|
$name = "Liste privée";
|
||||||
$TabList = array();
|
|
||||||
// $TabList[] = new ListTask(0, "Projet PHP");
|
// $TabList[] = new ListTask(0, "Projet PHP");
|
||||||
// $TabList[] = new ListTask(1, "Projet Blazor");
|
// $TabList[] = new ListTask(1, "Projet Blazor");
|
||||||
$TabListPriv = $this->model->getPrivateList();
|
$TabList = $this->taskModel->loadPrivateLists($_SESSION['login']);
|
||||||
require("../view/liste.php");
|
require("../view/liste.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newListPrivate(){
|
public function newListPrivate(){
|
||||||
$nom=$_POST['listeNom'];
|
$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,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require(__DIR__.'/config/config.php');
|
require_once("controller/FrontCtrl.php");
|
||||||
require(__DIR__.'/controller/FrontCtrl.php');
|
require("erreur.php");
|
||||||
|
|
||||||
|
$fc = new FrontCtrl();
|
||||||
|
$TMessage = array();
|
||||||
|
|
||||||
$front = new FrontController($con);
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
static $user = 'nifranco';
|
static $user = 'anboudoul';
|
||||||
static $pass = 'achanger';
|
static $pass = 'mdpMYSQL';
|
||||||
?>
|
?>
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
echo '<head>
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
|
||||||
rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
|
rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
|
||||||
crossorigin="anonymous">
|
crossorigin="anonymous">
|
||||||
</head>';
|
</head>
|
||||||
echo '<h1>'.$name.'</h1><center>';
|
<body>
|
||||||
echo '<div class="list-group list-group-light">';
|
<?php
|
||||||
foreach($TabList as $liste){
|
echo '<h1>'.$name.'</h1><center>';
|
||||||
echo '<button type="button" class="list-group-item list-group-item-action px-3 border-0">'.$liste->get_nom().'</button>';
|
echo '<div class="list-group list-group-light">';
|
||||||
}
|
foreach($TabList as $liste){
|
||||||
echo '</div></center>';
|
echo '<button type="button" class="list-group-item list-group-item-action px-3 border-0">'.$liste->get_nom().'</button>';
|
||||||
?>
|
}
|
||||||
|
echo '</div></center>';
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
@ -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