Compare commits

...

61 Commits

Author SHA1 Message Date
Anna BOUDOUL df38d77797 rendu
2 years ago
Anna BOUDOUL 4cb5f69436 merge and task done management
2 years ago
Anna BOUDOUL d0b7bcc83d test
2 years ago
Nicolas FRANCO 227cfa0942 fixed data null bug
2 years ago
Nicolas FRANCO 0b6a1ae665 erreur date format
2 years ago
Nicolas FRANCO 3c164338f7 error view fixed
2 years ago
Nicolas FRANCO 6183b2df04 Merge branch 'action&exception' of https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP into action&exception
2 years ago
Anna BOUDOUL dd8ae7ce1b other corrections
2 years ago
Nicolas FRANCO 1ef0dc68d7 Merge branch 'action&exception' of https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP into action&exception
2 years ago
Nicolas FRANCO 9eb1041ce7 connection error management
2 years ago
Anna BOUDOUL 11db506471 Correcting view error
2 years ago
Anna BOUDOUL 17092eec6a changes
2 years ago
Anna BOUDOUL 8d166927ae merge and changes
2 years ago
Anna BOUDOUL 549a68e30f task date saved
2 years ago
Nicolas FRANCO 561d27f4c9 all private task/list manipulation redirecting to myList instead of Home
2 years ago
Anna BOUDOUL 682cc8abd0 erase private list
2 years ago
Anna BOUDOUL 544c3cf283 merge again
2 years ago
Anna BOUDOUL ab67871e2b small changes to frontctrl
2 years ago
Nicolas FRANCO 4966402b38 fin actions
2 years ago
Anna BOUDOUL fbabc27785 merge
2 years ago
Anna BOUDOUL 9b27bb4b11 correcting list delete (delete task from this list as well)
2 years ago
Anna BOUDOUL 27e7cfa63f exception management again
2 years ago
Anna BOUDOUL 719916c2cb erase list action
2 years ago
Nicolas FRANCO a40e051ffb log out works (made some changes on controllers and gateway deconnection function)
2 years ago
Nicolas FRANCO 93020c97e4 correction findUser
2 years ago
Anna BOUDOUL 58e6442b48 Merge branch 'visitor-controller' of https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP into action&exception
2 years ago
Nicolas FRANCO 82e9331652 erase taks and complete task
2 years ago
Anna BOUDOUL 2534d9bf30 about action
2 years ago
Anna BOUDOUL 898626dc57 Start of exception management
2 years ago
Nicolas FRANCO d216c395f2 addList working with view
2 years ago
Nicolas FRANCO 4516560c70 fixed merge conflicts
2 years ago
Nicolas FRANCO f99970514e merge prep
2 years ago
Anna BOUDOUL db3e5db096 view task
2 years ago
Nicolas FRANCO 9ea620fa47 add list view working
2 years ago
Anna BOUDOUL fc60b17097 View about
2 years ago
Anna BOUDOUL 15bc35ab0a correcting bugs TabVues
2 years ago
Anna BOUDOUL 770cc345af TabVues
2 years ago
Anna BOUDOUL aaeb0ab80d Error view
2 years ago
Anna BOUDOUL 2f8076669c Merging error left corrected
2 years ago
Anna BOUDOUL 6b1c67a410 Merging
2 years ago
Anna BOUDOUL f04cfc060b Validation correction
2 years ago
Anna BOUDOUL 62924b327d Validation start
2 years ago
Nicolas FRANCO 03a4766c92 navigation in all existing pages
2 years ago
Nicolas FRANCO 3c93d6e282 fixed merge conflicts
2 years ago
Nicolas FRANCO 000f06f7e4 navigation works
2 years ago
Anna BOUDOUL 912b14e5b3 correcting a few bugs
2 years ago
Anna BOUDOUL 19a7a10262 merging
2 years ago
Anna BOUDOUL 7b122c7d82 UserCtrl almost finished
2 years ago
Nicolas FRANCO 25af41e0b8 index.php first try
2 years ago
Anna BOUDOUL 814b5219aa merge
2 years ago
Anna BOUDOUL 0e60561ef9 Test
2 years ago
Nicolas FRANCO 55a7b525b1 correction de l id Tache et List pour l autoincrement
2 years ago
Anna BOUDOUL 114dfccefb change UserCtrl
2 years ago
Nicolas FRANCO c350f1c747 connection and resgister view
2 years ago
Nicolas FRANCO ce33549edb vue home.php fonctionelle
2 years ago
Anna BOUDOUL 908ec8ebf4 merge2
2 years ago
Anna BOUDOUL 3754eba1d6 small changes
2 years ago
Anna BOUDOUL edefb53549 merge
2 years ago
Nicolas FRANCO b501e081f2 merge with userctrl
2 years ago
Nicolas FRANCO b4b5fb3d3e loadPublicLists faite
2 years ago
Nicolas FRANCO ca4a84a4a6 fonction loadPrivateLists, taskModel
2 years ago

@ -4,14 +4,17 @@
private string $nom; private string $nom;
private array $taches; private array $taches;
private $owner; private $owner;
private int $dc; // done counter private int $dc; // done counter # juste visuelle??
function __construct($id, $nom, $owner="", $dc = 0) { function __construct($nom, $owner="",$dc=0,$id=0) {
if($id==0)
$this->id = (int)null;
else
$this->id = $id; $this->id = $id;
$this->nom = $nom; $this->nom = $nom;
$this->taches = []; $this->taches = [];
$this->owner = $owner; $this->owner = $owner;
$this->dc = $dc; $this->dc = 0;
} }

@ -10,7 +10,13 @@
private string $idlist; // # id associating task to list private string $idlist; // # id associating task to list
private bool $isDone; // # si la tache est complete private bool $isDone; // # si la tache est complete
function __construct($id,$titre,$description,$priorite,$idl,$dateDeb="",$dateFin="",$isDone=false) { function __construct($titre,$description,$priorite,$idl,$dateDeb=null,$dateFin=null,$isDone=false,$id=0) {
# if id = 0, on veut donc creer une nouvelle tache
# qui n'est pas encore dans la base de donnée et donc
# le id sera fait avec le auto increment
if($id==0)
$this->set_id((int)null);
else
$this->set_id($id); $this->set_id($id);
$this->set_titre($titre); $this->set_titre($titre);
$this->set_description($description); $this->set_description($description);
@ -18,6 +24,7 @@
$this->set_dateDeb($dateDeb); $this->set_dateDeb($dateDeb);
$this->set_dateFin($dateFin); $this->set_dateFin($dateFin);
$this->set_idlist($idl); $this->set_idlist($idl);
$this->set_isDone($isDone);
} }
function get_id() { function get_id() {

@ -1,6 +1,6 @@
<?php <?php
class User{ class User{
private string $login; private string $login; // botar um id no final se der tempo
function __construct($login) { function __construct($login) {
$this->login = $login; $this->login = $login;

@ -0,0 +1,52 @@
Anna BOUDOUL
Nicolas FRANCO
#### Ce qui a été fait depuis l'oral:
- fonction `loadPrivateList` de la classe `TaskModel`
* utilise deux nouvelles fonctions: `findUserList` et `findListTask` du gateway pour charger les listes privées d'un user
- fonction `loadPublicLists` de la classe `TaskModel`
* utilise deux fonctions: `findPublicList` et `findListTask` du gateway pour charger les listes publiques
- vue home.php
* correction de la fonction `isConnected` qui est nécessaire dans cette vue
- contrôleur user
* constructeur
* méthode `deconnexion` associée à l'action `deconnecter`
* méthode `newListPrivate` associée à l'action `creerListePriv`
* méthode `loadListePriv` associée à l'action `voirListePriv`
* méthode `erasePrivList` associée à l'action `supprimerListePriv`
- vue connection.php
- vue newList.php
- vue register.php
- vue about.php
- vue newTask.php
- vue homePriv.php
- fin de la vue erreur.php
- navigation entre les pages avec `href=index.php?action=...`
- classe Validation
- utilisation de la classe validation dans le code
- "binding" des bouttons avec les actions correspondantes (pour les deux controlleurs, visitor et user)
- tableau de vues et tableau des messages d'erreurs
- corrections de bugs
#### Ce qui reste à faire
Nous avions envisagé de permettre à l'utilisateur d'afficher de plus amples informations sur les tâches, comme leurs dates de début et de fin et leur description, à l'aide d'un bouton sur nos vue home et home privé cependant nous n'avons pas eu le temps de le faire et par souci d'esthétisme et de lisibilité nous n'avons pas mis toutes ces informations dans le tableau des tâches pour chaque liste.
Nous souhaitions également afficher un compte des tâches faites sur le nombre de tâches total par liste mais nous n'avons pas eu le temps de terminer cette fonctionnalité.
Nous avons tout de même conservé les attributs qui étaient censés être utilisés dans ces fonctionnalités dans notre base de données et dans nos classes métiers en vue d'une possible amélioration de notre site.
#### Plus de détails
* vous pouvez trouver plus de détail sur notre dépot git disponible ici `https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP`, en regardant les commits qui ont été fait tout au long du projet.

@ -0,0 +1,33 @@
<?php
class Validation {
static function val_form_texte(&$texte, &$TMessage) {
if (!isset($texte)||$texte=="") {
$TMessage[] ="Empty fields";
$texte="";
}
if ($texte != filter_var($texte, FILTER_SANITIZE_STRING))
{
$TMessage[]="Attempt to inject code (security attack)";
$texte="";
}
}
static function val_form_mdp(&$mdp, &$TMessage) {
if (!isset($mdp)||$mdp=="") {
$TMessage[] ="Password not specified";
$mdp="";
}
if ($mdp != filter_var($mdp, FILTER_SANITIZE_SPECIAL_CHARS))
{
$TMessage[] ="Password must not contain special characters";
$mdp="";
}
}
}
?>

@ -1,7 +1,21 @@
<?php <?php
//gen require('dal/Connection.php');
$rep=__DIR__.'/../'; $rep=__DIR__.'/../';
require('dal/Connection.php'); //$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'achanger');
$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'achanger'); $con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'mdpMYSQL');
$TMessage = array();
$TabVues = array();
$TabVues["erreur"] = "view/erreur.php";
$TabVues["home"] = "view/home.php";
$TabVues["connection"] = "view/connection.php";
$TabVues["register"] = "view/register.php";
$TabVues["newList"] = "view/newList.php";
$TabVues["liste"] = "view/liste.php";
$TabVues["about"] = "view/about.php";
$TabVues["prives"] = "view/privHome.php";
?> ?>

@ -1,38 +1,44 @@
<?php <?php
require_once('../model/UserModel.php'); require_once("config/config.php");
require("model/UserModel.php");
class FrontController class FrontCtrl
{ {
private UserModel $ursMdl; // private UserModel $usrMdl;
private $action_User; private $action_User;
private bool $isUser;
private $TabVues;
function __construct(){ function __construct(&$con, $TabVues){
session_start(); session_start();
$ursMdl = new UserModel(); $this->TabVues = $TabVues;
$this->usrMdl = new UserModel($con);
$this->action_User = array('deconnecter', 'voirListePriv', 'creerListePriv', 'supprimerListePriv');
try{ try{
$user = $this->usrMdl->isUser(); // cette fonction retourne quoi?
$action = $_REQUEST['action'];
if(($i = array_search($action,$action_User)) !== false){ # si action dans la liste d'actions user $this->isUser = $this->usrMdl->isConnected();
if($user == null){ # si pas conncter $action = $_REQUEST['action'] ?? null;
if(($i = array_search($action,$this->action_User)) !== false){ # si action dans la liste d'actions user
if(!$this->isUser){ # si pas conncter
# appel controlleur visiteur avec action connecter # appel controlleur visiteur avec action connecter
require("VisitCtrl.php"); require("VisitorCtrl.php");
$visitCtrl = new VisitCtrl(); $visitCtrl = new VisitorCtrl($con, $this->TabVues, $this->isUser);
$visitCtrl->goconnexion(); //header ou inclure vue conn $visitCtrl->goconnexion();
} else { # sinon } else { # sinon
# handle action avec controlleur user # handle action avec controlleur user
require("UserCtrl.php"); require("UserCtrl.php");
$userCtrl = new UserCtrl();$visitCtrl = new VisitCtrl(); $userCtrl = new UserCtrl($con, $this->TabVues);
$visitCtrl->goconnexion();
} }
} else { # sinon forcement action visiteur } else { # sinon forcement action visiteur
# appel controlleur visiteur avec l'action # appel controlleur visiteur avec l'action
require("VisitCtrl.php"); require("VisitorCtrl.php");
$visitCtrl = new VisitCtrl(); $visitCtrl = new VisitorCtrl($con, $this->TabVues, $this->isUser);
} }
} catch (Exception $e){ // verifier si catch bon } catch (Exception $e){ // verifier si catch bon
require("../view/erreur.php"); $TMessage[] = $e->getMessage();
require($this->TabVues["erreur"]);
} }
} }
} }

@ -1,48 +1,77 @@
<?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;
private $TabVues;
public function __construct(Connection $con){ public function __construct(Connection $con, $TabVues){
$this->TabVues = $TabVues;
$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 'voirListePriv':
$this->loadListePriv();
break;
// ajouter une liste privee
case 'creerListePriv':
$this->newListPrivate();
break;
// // voir les listes privees // supprimer une liste privee
// case 'voir_liste_priv': case 'supprimerListePriv':
// $this->loadListePriv(); $this->erasePrivList();
// break; break;
// // ajouter une liste privee case 'deconnecter':
// case 'creer_liste_priv': $this->deconnexion();
// $this->newListPrivate(); break;
// break; default:
$TMessage[] = 'Unexpected error';
require($this->TabVues["erreur"]);
break;
// } }
// } catch(Exception $e) { } catch(Exception $e) {
// require("../view/erreur.php"); $TMessage[] = $e->getMessage();
// } require($this->TabVues["erreur"]);
}
} }
public function loadListePriv(){ public function loadListePriv(){
$name = "Liste privée"; $user = $_SESSION['login'];
$taskmdl = new TaskModel($this->con); $private_lists = $this->taskModel->loadPrivateLists($user);
$TabTask = $taskmdl->loadPublicLists(); require($this->TabVues["prives"]);
var_dump($TabTask);
// $TabList[] = new ListTask(0, "Projet PHP");
// $TabList[] = new ListTask(1, "Projet Blazor");
// $TabListPriv = $this->model->loadPrivateLists();
// require("../view/liste.php");
require("../view/task.php");
} }
public function newListPrivate(){ public function newListPrivate(){
$nom=$_POST['listeNom']; $this->taskModel->addList($_POST['listName'],$_SESSION['login']);
insertL(new ListTask(0, $nom, $_SESSION['login'])); $this->loadListePriv();
}
function erasePrivList(){
$this->taskModel->supList($_POST['listId']);
$this->loadListePriv();
}
function loadHome(){
$public_lists = $this->taskModel->loadPublicLists();
require($this->TabVues["home"]);
}
public function deconnexion(){
$this->userModel->deconnexion();
header("Location:index.php");
} }
} }
?> ?>

@ -1,14 +1,25 @@
<?php <?php
require_once("../model/TaskModel"); require("model/TaskModel.php");
class VisitCtrl
class VisitorCtrl
{ {
private $taskModel; private $taskModel;
function __construct(){ private $userModel;
$dvueErreur = array(); private $isUser;
$taskModel = new TaskModel(); private $TabVues;
function __construct($con, $TabVues, $isUser){
$this->TabVues = $TabVues;
$this->isUser = $isUser;
$dvueErreur = array();
$this->taskModel = new TaskModel($con);
$this->userModel = new UserModel($con);
try{ try{
if(isset($_REQUEST['action']))
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
else
$action = null;
switch($action){ switch($action){
case null: case null:
$this->loadHome(); $this->loadHome();
@ -19,11 +30,24 @@ class VisitCtrl
$this->go_connection(); $this->go_connection();
break; break;
case 'pageAbout':
$this->go_about();
break;
case 'connecter': case 'connecter':
$this->connection(); $this->connection();
# charge la vue de connexion # charge la vue de connexion
break; break;
case 'pageRegister':
$this->go_register();
break;
case 'register':
$this->register();
# charge la vue de connexion
break;
case 'pageListe': case 'pageListe':
$this->go_list(); $this->go_list();
break; break;
@ -52,59 +76,116 @@ class VisitCtrl
# supprimer une tache # supprimer une tache
break; break;
case 'isDone':
$this->isDone();
break;
default: default:
# $TMessage[] = 'Unexpected error';
$dvueErreur[] = 'Erreur inattendue'; require($this->TabVues["erreur"]);
require($rep.$vues['']); $this->loadHome();
break; break;
} }
} catch (Exception $e) { } catch (Exception $e) {
require("../view/erreur.php"); var_dump($_POST);
$TMessage[] = $e->getMessage();
require($this->TabVues["erreur"]);
}
} }
function loadHome(){ function loadHome(){
# instancie tableau / donnees $public_lists = $this->taskModel->loadPublicLists();
# requere vue # le if suivant est nécéssaire dans le cas ou l'action
# dans vue check if isset # connection a été appeller. Dans ce cas, loadHome doit
# display content # prendre en compte le user qui vient d'être ajouter a
$public_lists = $this->taskModel.loadPublicList(); # $_SESSION['login']
if(isset($_SESSION['login']) && $_SESSION['login'] != "")
$user = $_SESSION['login'];
else
$user = $this->isUser;
require($this->TabVues["home"]);
} }
function go_connection(){ function go_connection(){
$user = $this->isUser;
require($this->TabVues["connection"]);
}
function go_about(){
$user = $this->isUser;
require($this->TabVues["about"]);
} }
function connection(){ function connection(){
$isCo = $this->userModel->connexion($_POST['username'],$_POST['password']);
if(!$isCo){
$TMessage[] = 'This user does not exist'; require($this->TabVues["erreur"]);
$this->loadHome();
}
else
$this->loadHome();
}
function go_register(){
$user = $this->isUser;
require($this->TabVues["register"]);
} }
function go_list(){ function register(){
$this->userModel->ajouter($_POST['username'],$_POST['password']);
$this->go_connection();
}
function go_list(){
$user = $this->isUser;
require("view/newList.php");
} }
function makeList(){ function makeList(){
$this->taskModel->addList($_POST['listName']);
$this->loadHome();
} }
function eraseList(){ function eraseList(){
$this->taskModel->supList($_POST['listId']);
$this->loadHome();
} }
function go_task(){ function go_task(){
$user = $this->isUser;
if(isset($_POST['listId'])) $_SESSION['listId'] = $_POST['listId'];
if(isset($_POST['isPriv'])) $_SESSION['isPriv'] = $_POST['isPriv'];
require("view/newTask.php");
} }
function addTask(){ function addTask(){
$this->taskModel->addTask($_POST['titreT'],$_POST['descT'],
$_POST['prioriteT'],$_SESSION['listId'],$_POST['dateDebT'],$_POST['dateFinT']);
if(isset($_SESSION['isPriv']) && $_SESSION['isPriv'])
header("Location:index.php?action=voirListePriv");
else
$this->loadHome();
} }
function eraseTask(){ function eraseTask(){
$this->taskModel->supTask($_POST['idT']);
if(!empty($_POST['isPriv']))
header("Location:index.php?action=voirListePriv");
else
$this->loadHome();
} }
function isDone(){
if ($_POST['Tdone'])
$this->taskModel->modifTask($_POST['idT'],'isDone',false);
else
$this->taskModel->modifTask($_POST['idT'],'isDone',true);
if(!empty($_POST['isPriv']))
header("Location:index.php?action=voirListePriv");
else
$this->loadHome();
} }
} }
?> ?>

@ -1,6 +1,7 @@
<?php <?php
require_once("Connection.php"); require_once("business/ListTask.php");
include_once("../business/Task.php"); include_once("business/Task.php");
class TaskGateway class TaskGateway
{ {
@ -15,18 +16,24 @@ class TaskGateway
// functions // functions
// code de retour pour les fonctions i,u,d? // code de retour pour les fonctions i,u,d?
public function insertT(Task $t){ public function insertT(Task $t){
$query='INSERT INTO Tache VALUES (:id,:titre,:descript,NULL,NULL,:priorite,:idList,false)'; $query='INSERT INTO Tache VALUES (:id,:titre,:descript,:dateDeb,:dateFin,:priorite,:idList,false)';
if($t->get_dateDeb() == null)
$dateDeb = NULL;
else
$dateDeb = $t->get_dateDeb();
if($t->get_dateFin() == null)
$dateFin = NULL;
else
$dateFin = $t->get_dateFin();
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
':id'=> array($t->get_id(),PDO::PARAM_STR), ':id'=> array($t->get_id(),PDO::PARAM_STR),
':titre'=> array($t->get_titre(),PDO::PARAM_STR), ':titre'=> array($t->get_titre(),PDO::PARAM_STR),
':descript'=> array($t->get_description(),PDO::PARAM_STR), ':descript'=> array($t->get_description(),PDO::PARAM_STR),
':dateDeb'=> array($dateDeb,PDO::PARAM_STR),
':dateFin'=> array($dateFin,PDO::PARAM_STR),
':priorite'=> array($t->get_priorite(),PDO::PARAM_STR), ':priorite'=> array($t->get_priorite(),PDO::PARAM_STR),
':idList'=> array($t->get_idList(),PDO::PARAM_STR) )); ':idList'=> array($t->get_idList(),PDO::PARAM_STR) ));
/*Comment gerer les erreurs?
* si valeur existe deja
*/
} }
public function update($table,$id,$element, $valeur){ public function update($table,$id,$element, $valeur){
@ -44,7 +51,8 @@ class TaskGateway
if($table == 'task'){ if($table == 'task'){
$query='DELETE FROM Tache WHERE id = :id'; $query='DELETE FROM Tache WHERE id = :id';
} else { } else {
$query='DELETE FROM uList WHERE id = :id'; $query='DELETE FROM uList WHERE id = :id;
DELETE FROM Tache WHERE idList = :id;';
} }
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
':id'=>array($id,PDO::PARAM_STR))); ':id'=>array($id,PDO::PARAM_STR)));
@ -72,8 +80,8 @@ class TaskGateway
$results=$this->con->getResults(); $results=$this->con->getResults();
foreach($results as $row) foreach($results as $row)
{ {
$tabResult[]=new Task($row['id'],$row['titre'],$row['description'],$row['priorite'], $tabTaches[]=new Task($row['titre'],$row['description'],$row['priorite'],
$row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone']); $row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone'],$row['id']);
} }
return $tabResult; return $tabResult;
@ -93,7 +101,7 @@ class TaskGateway
$results=$this->con->getResults(); $results=$this->con->getResults();
foreach($results as $row) foreach($results as $row)
{ {
$tabResult[]=new ListTask($row['id'],$row['nom'],$row['user'],$row['dc']); $tabList[]=new ListTask($row['nom'],$row['user'],$row['dc'],$row['id']);
} }
return $tabResult; return $tabResult;
} }
@ -111,5 +119,67 @@ class TaskGateway
':nom'=> array($l->get_nom(),PDO::PARAM_STR), ':nom'=> array($l->get_nom(),PDO::PARAM_STR),
':user'=> array($l->get_owner(),PDO::PARAM_STR))); ':user'=> array($l->get_owner(),PDO::PARAM_STR)));
} }
public function count($list){
$query='SELECT COUNT(*) from Tache where idList = :idList';
$this->con->executeQuery($query, array(
':idList' => array($list->get_id(),PDO::PARAM_INT)
));
$result = $this->con->getResults();
foreach($result as $row){
$taille = $row[0];
}
return $taille;
}
public function findUserList($user){
# pas réussit a faire une jointure optimale donc
# decomposé en plusieurs foncitons:
# findUserList
# findTacheList
$query='SELECT * from uList where user = :user';
$this->con->executeQuery($query, array(
':user' => array($user,PDO::PARAM_STR)
));
$tabLists = array();
$results = $this->con->getResults();
foreach($results as $row){
$tabLists[]= new ListTask($row[1],$row[2],$row[3],$row[0]);
}
return $tabLists;
}
public function findListTask($list){
$query='SELECT * from Tache where idList = :idList';
$this->con->executeQuery($query, array(
':idList' => array($list->get_id(),PDO::PARAM_STR)
));
$results = $this->con->getResults();
foreach($results as $row){
$taches[]= new Task($row['titre'],$row['description'],$row['priorite'],
$row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone'],$row['id']);
}
if(!empty($taches))
$list->set_taches($taches);
return $list;
}
public function findPublicList(){
$query='SELECT * from uList where user is NULL';
$this->con->executeQuery($query);
$tabLists = array();
$results = $this->con->getResults();
foreach($results as $row){
$tabLists[]= new ListTask($row[1],$row[2],$row[3],$row[0]);
}
return $tabLists;
}
} }
?> ?>

@ -47,7 +47,8 @@
$query = 'SELECT mdp FROM User WHERE login = :login'; $query = 'SELECT mdp FROM User WHERE login = :login';
$this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR))); $this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR)));
$result = $this->con->getResults(); $result = $this->con->getResults();
if(password_verify($mdp, $result[0]['mdp'])) if(empty($result[0][0])) return;
if(password_verify($mdp, $result[0][0]))
return $login; return $login;
} }
} }

@ -0,0 +1,58 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Structure de la table `tache`
--
DROP TABLE IF EXISTS `tache`;
CREATE TABLE IF NOT EXISTS `tache` (
`id` int NOT NULL AUTO_INCREMENT,
`titre` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`dateDebut` date DEFAULT NULL,
`dateFin` date DEFAULT NULL,
`priorite` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`idList` int NOT NULL,
`isDone` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_list` (`idList`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- --------------------------------------------------------
--
-- Structure de la table `ulist`
--
DROP TABLE IF EXISTS `ulist`;
CREATE TABLE IF NOT EXISTS `ulist` (
`id` int NOT NULL AUTO_INCREMENT,
`nom` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`user` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`dc` int NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_list_owner` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- --------------------------------------------------------
--
-- Structure de la table `user`
--
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`login` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`mdp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
COMMIT;

@ -1,8 +1,7 @@
<?php <?php
$fc = new FrontCtrl(); require("config/config.php");
$TMessage = array(); require('config/Validation.php');
require_once("controller/FrontCtrl.php"); require_once("controller/FrontCtrl.php");
require("erreur.php"); $fc = new FrontCtrl($con, $TabVues);
?> ?>

@ -1,6 +1,6 @@
<?php <?php
include_once("../dal/TaskGateway.php"); include_once("dal/TaskGateway.php");
include_once("../business/Task.php"); include_once("business/Task.php");
class TaskModel class TaskModel
{ {
@ -13,9 +13,9 @@ class TaskModel
$this->gtw= new TaskGateway($con); $this->gtw= new TaskGateway($con);
} }
public function addTask($id,$titre,$desc,$priorite,$idList,$dateDeb="",$dateFin="",$isDone=false) public function addTask($titre,$desc,$priorite,$idList,$dateDeb=null,$dateFin=null,$isDone=false,$id=0)
{ {
$t = new Task($id,$titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone); $t = new Task($titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone,$id);
$this->gtw->insertT($t); $this->gtw->insertT($t);
// retourne quoi? con->lastInsertId() ?? // retourne quoi? con->lastInsertId() ??
} }
@ -41,9 +41,10 @@ class TaskModel
} }
/* LIST FUNCTIONS */ /* LIST FUNCTIONS */
public function addList($id,$nom,$owner="",$dc=0) public function addList($nom,$owner="",$dc=0,$id=0)
{ {
$l = new ListTask($id,$nom,$owner="",$dc=0); Validation::val_form_texte($owner, $TMessage);
$l = new ListTask($nom,$owner,$dc);
$this->gtw->insertL($l); $this->gtw->insertL($l);
// retourne quoi? con->lastInsertId() ?? // retourne quoi? con->lastInsertId() ??
} }
@ -53,6 +54,11 @@ class TaskModel
$this->gtw->update('list',$id,$element,$valeur); $this->gtw->update('list',$id,$element,$valeur);
} }
public function size($list){
$taille = $this->gtw->count($list);
return $taille;
}
public function supList($id) public function supList($id)
{ {
$this->gtw->delete('list',$id); $this->gtw->delete('list',$id);
@ -60,7 +66,23 @@ class TaskModel
function loadPublicLists() function loadPublicLists()
{ {
return $this->gtw->find('list','user', 'RicharlisonR9'); $lists = $this->gtw->findPublicList();
foreach($lists as &$row){
$row = $this->gtw->findListTask($row);
}
return $lists;
}
function loadPrivateLists($user){
# prend toutes les listes de l'user
$lists = $this->gtw->findUserList($user);
# pour chacune de ses listes, charge les taches
foreach($lists as &$row){
$row = $this->gtw->findListTask($row);
}
return $lists;
} }
} }
?> ?>

@ -1,5 +1,8 @@
<?php <?php
require('../business/User.php'); require('business/User.php');
require('dal/UserGateway.php');
require_once("config/config.php");
class UserModel{ class UserModel{
private $con; private $con;
private $gat; private $gat;
@ -10,43 +13,52 @@
} }
function connexion($login, $mdp){ function connexion($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$result = $this->gat->findUser($login, $mdp); $result = $this->gat->findUser($login, $mdp);
if (isset($result))
{ if(!isset($result)){
return false;
} else {
$_SESSION['login'] = $result; $_SESSION['login'] = $result;
return true;
} }
echo $_SESSION['login'];
} }
function deconnexion(){ function deconnexion(){
session_unset(); session_unset();
session_destroy(); session_destroy();
$_SESSION = array();
} }
function isConnected($login){ //teste rôle dans la session, retourne instance dobjet ou booleen function isConnected(){ //teste rôle dans la session, retourne instance dobjet ou booleen
if ($_SESSION['login']) Validation::val_form_texte($_SESSION['login'], $TMessage);
{ if(isset($_SESSION['login']) && $_SESSION['login']!="")
return true; return true;
} else
else return false; return false;
} }
function ajouter($login, $mdp){ function ajouter($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$user = $this->findByLogin($login); $user = $this->findByLogin($login);
if (empty($user)) if (empty($user))
$this->gat->create($login, $mdp); $this->gat->create($login, $mdp);
} }
function supprimer($login){ function supprimer($login){
Validation::val_form_texte($login, $TMessage);
$this->gat->delete($login); $this->gat->delete($login);
} }
function modifMdp($login, $mdp){ function modifMdp($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$this->gat->updateMdp($login, $mdp); $this->gat->updateMdp($login, $mdp);
} }
function findByLogin($login){ function findByLogin($login){
Validation::val_form_texte($login, $TMessage);
$user = null; $user = null;
if ($login !== " " && $login != null ) if ($login !== " " && $login != null )
{ {
@ -59,6 +71,8 @@
} }
function modifLogin($oldLogin, $newLogin){ function modifLogin($oldLogin, $newLogin){
Validation::val_form_texte($oldLogin, $TMessage);
Validation::val_form_texte($newLogin, $TMessage);
$user = $this->findByLogin($oldLogin); $user = $this->findByLogin($oldLogin);
if (empty($user)) if (empty($user))
$this->gat->updateLogin($oldLogin, $newLogin); $this->gat->updateLogin($oldLogin, $newLogin);

@ -0,0 +1,119 @@
<?php
require_once("business/Task.php");
require_once("business/ListTask.php");
require_once("dal/TaskGateway.php");
require_once("controller/VisitorCtrl.php");
require_once("dal/Connection.php");
//echo "<h1>2do test</h1>";
# Test de la Gateway Tache
# nouvelle tache
# $t = new Task(5,'tacheNotErr','desc.','urgent','001');
# connection
$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'achanger');
# gateway
// $t = new Task(3,'richarlison voltar pro flu','desc.','urgent','0');
// $tgt = new TaskGateway($con);
// $tgt->insertT($t);
//$tgt->delete('10');
//$taches = $tgt->findUserList('nifranco');
// foreach($taches as $t){
// echo $t->get_id()." ".$t->get_idList()."<br>";
// }
# test find
// $tasks=$tgt->find('idList','001');
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
# Test du modele Tache
// $mt= new TaskModel($con);
//$mt->addTask('3','testIsDone','desc.','urgent','001');
//$mt->modifTask('3','isDone','1');
//$tasks = $mt->getTaskBy('titre','tache1');
// $tasks = $mt->getAllTask();
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
# Test LOAD PRIVATE TASKS
$mt= new TaskModel($con);
$mt->addList('Nicolas2do');
# Test LOAD PRIVATE TASKS
// $mt= new TaskModel($con);
// $mt->addList('private','nifranco');
// $lists = $mt->loadPublicLists();
// foreach($lists as $l){
// echo 'List: '.$l->get_id()."<br>";
// echo "Tasks: <br>";
// foreach($l->get_taches() as $t){
// echo $t->get_id()."<br>";
// }
// }
// //$tasks = $mt->getTaskBy('titre','tache1');
// $tasks = $mt->getAllTask();
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
// $tasks = $mt->loadPublicLists();
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
// $mt->addList('002','todo2','nifranco');
// $mt->modifList('2','nom','22do');
//mt->supList('2');
// $public_lists = $mt->loadPrivateLists('nifranco');
// $user = true;
//require("../view/home.php");
//require("../view/register.php");
//require("../view/connection.php");
/* -------------
TEST ANNA
----------------*/
require('../dal/UserGateway.php');
require('../model/UserModel.php');
require('../controller/UserCtrl.php');
// Test Gateway User
// $gat = new UserGateway($con);
// $gat->create('Nicolas', 'tranquilloubilou');
// $gat->updateLogin('Nicolas', 'RicharlisonR9');
// $gat->updateMdp('RicharlisonR9', 'hexachampion');
// $tab = $gat->find('RicharlisonR9', 'login');
// $gat->delete('RicharlisonR9');
// Test Modèle User
//$mu = new UserModel($con);
//$res = $mu->connexion('nifranco','achanger');
//var_dump($res);
$mdl = new UserModel($con);
// $mdl->ajouter('Anna', 'unmdptrescomplique');
// $mdl->modifLogin('Anna', 'Aeryn');
// $mdl->modifMdp('Aeryn', 'wtfmec');
// $mdl->supprimer('Aeryn');
// $mdl->connexion('Aeryn', 'wtfmec');
// $mt->addList("Test Liste");
// $mt->addList("Liste publique");
// $mt->addList("Liste privée", "Aeryn");
// $mt->addList("Projet de PHP", "Aeryn");
// $mt->addList("Projet Blazor", "Aeryn");
// $mt->addList("Projet de PHP", "RicharlisonR9");
// $mt->addList("Projet Blazor", "RicharlisonR9");
// TEST USER CONTROLLER
// session_start();
// $_SESSION['login'] = 'RicharlisonR9';
// $usrctrl = new UserCtrl($con);
// $usrctrl->loadHome();
?>

@ -1,4 +1,4 @@
<?php <?php
static $user = 'anboudoul'; static $user = 'anboudoul';
static $pass = 'achanger'; static $pass = 'mdpMYSQL';
?> ?>

@ -1,74 +0,0 @@
<?php
require_once("../business/Task.php");
require_once("../business/ListTask.php");
require_once("../dal/TaskGateway.php");
require_once("../model/TaskModel.php");
echo "<h1>2do test</h1>";
# Test de la Gateway Tache
# nouvelle tache
# connection
include("credentials.php");
$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'achanger');
# gateway
// $t = new Task(3,'richarlison voltar pro flu','desc.','urgent','0');
// $tgt = new TaskGateway($con);
// $tgt->insertT($t);
//$tgt->delete('10');
# test find
/*$tasks=$tgt->find('idList','001');
foreach($tasks as $i)
echo $i->get_id()."<br>"; */
# Test du modele Tache
// $mt= new TaskModel($con);
//$mt->addTask('3','testIsDone','desc.','urgent','001');
//$mt->modifTask('3','isDone','1');
// //$tasks = $mt->getTaskBy('titre','tache1');
// $tasks = $mt->getAllTask();
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
// $tasks = $mt->loadPublicLists();
// foreach($tasks as $i)
// echo $i->get_id()."<br>";
// $mt->addList('002','todo2','nifranco');
// $mt->modifList('2','nom','22do');
//mt->supList('2');
/* -------------
TEST ANNA
----------------*/
require('../dal/UserGateway.php');
require('../model/UserModel.php');
require('../controller/UserCtrl.php');
// Test Gateway User
// $gat = new UserGateway($con);
// $gat->create('Nicolas', 'tranquilloubilou');
// $gat->updateLogin('Nicolas', 'RicharlisonR9');
// $gat->updateMdp('RicharlisonR9', 'hexachampion');
// $tab = $gat->find('RicharlisonR9', 'login');
// $gat->delete('RicharlisonR9');
// Test Modèle User
// $mdl = new UserModel($con);
// $mdl->ajouter('Anna', 'unmdptrescomplique');
// $mdl->modifLogin('Anna', 'Aeryn');
// $mdl->modifMdp('Aeryn', 'wtfmec');
// $mdl->supprimer('Aeryn');
// $mdl->connexion('Aeryn', 'wtfmec');
$usrctrl = new UserCtrl($con);
// $usrctrl->loadListePriv();
$usrctrl->loadListePriv();
?>

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenu de la page ici-->
<div class="container-fluid">
<center>
<div class="col-lg-4 mb-5 mb-lg-0 text-center">
<div>
<div class="rounded-5 shadow-3-soft p-4" style="background-color: #fff9f2">
<div class="border-top border-dark mx-auto" style="width: 100px"></div>
<p class="text-muted mt-4 mb-2">2Do</p>
<p class="h5 mb-4" style="color: #344e41">A PHP project</p>
<p class="pb-4 mb-4">
A little PHP project realised by two french students studying Computer Science at the IUT of
Clermont Auvergne in France. The main goal of this project was to create a little To Do List
using the PHP language. We hope that you will find it useful.
</p>
</div>
</div>
</div>
</center>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="../view/js/home.js"></script>
</body>
</html>

@ -1,28 +0,0 @@
body{
text-align : center;
}
form{
display : flex;
flex-flow : column nowrap;
align-items : center;
}
input{
width : 90%;
border-radius : 5px;
color : #595959;
}
label{
margin-top : 20px;
}
#envoyer{
width : 150px;
height : 30px;
}
#btnEnvoi{
margin: 20px;
}

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="#!">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenue de la page ici-->
<div class="container-fluid">
<h1 class="text-center my-3 pb-3">Welcome back!</h1>
<form action="index.php" method="post">
<!-- Login input -->
<div class="form-outline mb-4 align-items-center">
<input name="username" type="text" id="form2Example1" class="form-control" required/>
<label class="form-label" for="form2Example1">Username</label>
</div>
<!-- Password input -->
<div class="form-outline mb-4">
<input name="password" type="password" id="form2Example2" class="form-control" required/>
<label class="form-label" for="form2Example2">Password</label>
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary btn-block mb-4">Log In</button>
<input type="hidden" name="action" value="connecter" ></input>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -1,5 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<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>
<?php <?php
foreach($TMessage as $err) { foreach($TMessage as $err) {
echo $err . "<br/>"; echo '<div class="alert alert-danger alert-dismissible d-flex align-items-center fade show">
<i class="bi-exclamation-octagon-fill"></i>
<strong class="mx-2">Error!</strong>' . $err . "</div>";
} }
?> ?>
</body>
</html>

@ -1 +0,0 @@
<a href="CtrlUser.php?action=exaction&id=1"

@ -0,0 +1,152 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!-- Page content-->
<div class="container-fluid">
<h1 class="mt-4">Public lists</h1>
<?php
# check if set
foreach($public_lists as $l){
echo '
<section class="vh-0" 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">
<form action="index.php" method="post" class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2">
<div class="col-12 position-absolute top-0 start-0">
<button type="submit" class="btn btn-danger">&#128465;</button>
<input type="hidden" name="listId" value="'.$l->get_id().'"></input>
<input type="hidden" name="action" value="supprimerListe"></input>
</div>
</form>
<h4 class="text-center my-3 pb-3">'.$l->get_nom().'</h4>
<form action="index.php" method="post" 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 &#128221;</button>
<input type="hidden" name="listId" value="'.$l->get_id().'"></input>
<input type="hidden" name="action" value="pageTache"></input>
</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>';
# IF NO TASKS, display NO TASKS
if(!empty($l->get_taches())){
foreach($l->get_taches() as $t){
if(!$t->get_isDone()){
echo '
<tr>
<td>'.$t->get_titre().'</td>
<td>'.$t->get_priorite().'</td>';
} else {
echo '
<tr>
<td><del>'.$t->get_titre().'</del></td>
<td><del>'.$t->get_priorite().'</del></td>';
}
echo '
<td>
<form action="index.php" method="post" class="d-inline-block">';
if(!$t->get_isDone()){
echo '<button type="submit" class="btn btn-success ms-1">&#10004;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="Tdone" value="'.$t->get_isDone().'"></input>
<input type="hidden" name="action" value="isDone">
</button>';
} else {
echo '<button type="submit" class="btn btn-secondary ms-1">&#10006;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="Tdone" value="'.$t->get_isDone().'"></input>
<input type="hidden" name="action" value="isDone">
</button>';
}
echo '
</form>
<form action="index.php" method="post" class="d-inline-block">
<button type="submit" class="btn btn-danger">&#128465;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="action" value="supprimerTache">
</button>
</form>
</td>
</tr>';
}
} else {
echo '<h6 class="text-center my-3 pb-3">No tasks here yet!</h6>';
}
echo ' </tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>';
}
?>
</div>
</div>
</div>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</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 &#128221;</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">&#128465;</button>
</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="../view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenue de la page ici-->
<div class="container-fluid">
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="../view/js/home.js"></script>
</body>
</html>

@ -0,0 +1,41 @@
<!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">New 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">
<div class="form-outline">
<input type="text" id="form1" class="form-control" />
</div>
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary">Save</button>
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary">Make private &#128274;</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>

@ -0,0 +1,35 @@
/*!
* Start Bootstrap - Simple Sidebar v6.0.5 (https://startbootstrap.com/template/simple-sidebar)
* Copyright 2013-2022 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Toggle the side navigation
const sidebarToggle = document.body.querySelector('#sidebarToggle');
if (sidebarToggle) {
// Uncomment Below to persist sidebar toggle between refreshes
// if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
// document.body.classList.toggle('sb-sidenav-toggled');
// }
sidebarToggle.addEventListener('click', event => {
event.preventDefault();
document.body.classList.toggle('sb-sidenav-toggled');
localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled'));
});
}
});
function hideShow() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}

@ -1,19 +0,0 @@
<!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>
<?php
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>';
?>
</body>
</html>

@ -1,13 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="en">
<head> <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" <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" <meta name="description" content="" />
crossorigin="anonymous"> <meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head> </head>
<body> <body>
<section class="vh-100" style="background-color: #eee;"> <div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenue de la page ici-->
<div class="container-fluid">
<section class="vh-50" style="background-color: #eee;">
<div class="container py-5 h-100"> <div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center 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="col col-lg-9 col-xl-7">
@ -15,20 +55,24 @@
<div class="card-body p-4"> <div class="card-body p-4">
<h4 class="text-center my-3 pb-3">New List</h4> <h4 class="text-center my-3 pb-3">New List</h4>
<form class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2"> <form action="index.php" class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2" method="post">
<div class="col-12"> <div class="col-12">
<div class="form-outline"> <div class="form-outline">
<input type="text" id="form1" class="form-control" /> <input type="text" id="form1" class="form-control" name="listName" required/>
</div> </div>
</div> </div>
<div class="col-12"> <button type="submit" class="btn btn-primary">Add</button>
<button type="submit" class="btn btn-primary">Save</button> <input type="hidden" name="action" value="creerListe"></input>
</div>
<div class="col-12"> <?php
<button type="submit" class="btn btn-primary">Make private &#128274;</button> if($user){
</div> echo '
<label for="privateRadio" class="form-check-label">
<input class="form-check-input" type="radio" name="action" value="creerListePriv"> Private &#128274
</label>';
}
?>
</form> </form>
</div> </div>
@ -37,5 +81,12 @@
</div> </div>
</div> </div>
</section> </section>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</body> </body>
</html> </html>

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageRegister">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenue de la page ici-->
<div class="container-fluid">
<h4 class="text-center my-3 pb-3">New Task</h4>
<form method="post" action="index.php">
<div class="form-outline mb-4 align-items-center">
<label class="form-label" for="form2title">Name</label>
<input name="titreT" type="text" id="form2title" class="form-control" required minlength="0" maxlength="250"/>
</div>
<div class="form-outline mb-4">
<label class="form-label" for="form2description">Description</label>
<input name="descT" type="text" id="form2description" class="form-control" minlength="0" maxlength="250">
</div>
<div class="form-outline mb-4">
<label class="form-label" for="form2dateDeb">Starting date</label>
<input name="dateDebT" type="date" id="form2dateDeb" class="form-control">
</div>
<div class="form-outline mb-4">
<label class="form-label" for="form2dateFin">Ending date</label>
<input name="dateFinT" type="date" id="form2dateFin" class="form-control">
</div>
<!-- <div class="form-outline mb-4">
<input name="prioriteT" type="text" id="form2importance" class="form-control" />
<label class="form-label" for="form2importance">Importance</label>
</div> -->
<div class="form-outline mb-4">
<label class="form-label" for="form2importance">Importance</label>
<select name="prioriteT" id="form2importance" class="form-control">
<option value="">--Please choose an option--</option>
<option value="Urgent">Urgent</option>
<option value="Important">Important</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
<option value="None">None</option>
</select>
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary btn-block mb-4" >Save</button>
<input type="hidden" name="action" value="ajouterTache"></input>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</body>
</html>

@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>
</ul>
</div>
</div>
</nav>
<!-- Page content-->
<div class="container-fluid">
<h1 class="mt-4">My Lists</h1>
<?php
if(empty($private_lists)){
echo'
<div class="d-flex align-items-center justify-content-center">
<a href="index.php?action=pageListe" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-envelope"></span>Add List &#10133;</a>
</div>';
}
foreach($private_lists as $l){
echo '
<section class="vh-0" 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">
<form action="index.php" method="post" class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2">
<div class="col-12 position-absolute top-0 start-0">
<button type="submit" class="btn btn-danger">&#128465;</button>
<input type="hidden" name="listId" value="'.$l->get_id().'"></input>
<input type="hidden" name="action" value="supprimerListePriv"></input>
</div>
</form>
<h4 class="text-center my-3 pb-3">'.$l->get_nom().'</h4>
<form action="index.php" method="post" 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 &#128221;</button>
<input type="hidden" name="listId" value="'.$l->get_id().'"></input>
<input type="hidden" name="action" value="pageTache"></input>
<input type="hidden" name="isPriv" value="true"></input>
</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>';
# IF NO TASKS, display NO TASKS
if(!empty($l->get_taches())){
foreach($l->get_taches() as $t){
if(!$t->get_isDone()){
echo '
<tr>
<td>'.$t->get_titre().'</td>
<td>'.$t->get_priorite().'</td>';
} else {
echo '
<tr>
<td><del>'.$t->get_titre().'</del></td>
<td><del>'.$t->get_priorite().'</del></td>';
}
echo '
<td>
<form action="index.php" method="post" class="d-inline-block">';
if(!$t->get_isDone()){
echo '<button type="submit" class="btn btn-success ms-1">&#10004;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="Tdone" value="'.$t->get_isDone().'"></input>
<input type="hidden" name="action" value="isDone">
<input type="hidden" name="isPriv" value="true">
</button>';
} else {
echo '<button type="submit" class="btn btn-secondary ms-1">&#10006;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="Tdone" value="'.$t->get_isDone().'"></input>
<input type="hidden" name="action" value="isDone">
<input type="hidden" name="isPriv" value="true">
</button>';
}
echo '
</form>
<form action="index.php" method="post" class="d-inline-block">
<button type="submit" class="btn btn-danger">&#128465;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="action" value="supprimerTache">
<input type="hidden" name="isPriv" value="true">
</button>
</form>
</td>
</tr>';
}
} else {
echo '<h6 class="text-center my-3 pb-3">No tasks here yet!</h6>';
}
echo ' </tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>';
}
?>
</div>
</div>
</div>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</body>
</html>

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="view/css/home.css" rel="stylesheet" />
</head>
<body>
<div class="d-flex" id="wrapper">
<!-- Sidebar-->
<div class="border-end bg-white" id="sidebar-wrapper">
<div class="sidebar-heading border-bottom bg-light">2do</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php">Home</a>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageListe">New List +</a>
<?php
if($user){
echo '<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=voirListePriv">My Lists &#128274;</a>';
}
?>
<a class="list-group-item list-group-item-action list-group-item-light p-3" href="index.php?action=pageAbout">About</a>
</div>
</div>
<!-- Page content wrapper-->
<div id="page-content-wrapper">
<!-- Top navigation-->
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<div class="container-fluid">
<button class="btn btn-primary" id="sidebarToggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mt-2 mt-lg-0">
<?php
if($user){
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=deconnecter">Log out</a></li>';
} else {
echo '<li class="nav-item"><a class="nav-link" href="index.php?action=pageConnection">Log In</a></li>';
echo '<li class="nav-item"><a class="nav-link" href="#!">Register</a></li>';
}
?>
</ul>
</div>
</div>
</nav>
<!--Contenue de la page ici-->
<div class="container-fluid">
<h2 class="text-center my-3 pb-3">Make private lists with a personnal account</h2>
<form action="index.php" method="post">
<!-- Login input -->
<div class="form-outline mb-4 align-items-center">
<input name="username" type="text" id="form2Example1" class="form-control" required/>
<label class="form-label" for="form2Example1">Username</label>
</div>
<!-- Password input -->
<div class="form-outline mb-4">
<input name="password" type="password" id="form2Example2" class="form-control" required/>
<label class="form-label" for="form2Example2">Password</label>
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary btn-block mb-4">Register</button>
<input type="hidden" name="action" value="register" ></input>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="view/js/home.js"></script>
</body>
</html>
Loading…
Cancel
Save