Compare commits

...

95 Commits
user ... master

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
Anna BOUDOUL 65d4ad2d24 suite controleur
2 years ago
Anna BOUDOUL b682361022 merge
2 years ago
Nicolas FRANCO e518f24104 erreur dans la fonction find pour loadPublicList
2 years ago
Anna BOUDOUL c44f73d524 Merge branch 'master' of https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP into userctrl
2 years ago
Anna BOUDOUL 840ec257e1 début user controller
2 years ago
Nicolas FRANCO 62bba32851 visitor controller structure
2 years ago
Anna BOUDOUL cfcc627fd7 suite
2 years ago
Nicolas FRANCO 30f4fa92c9 fixed merge conflicts with user branch
2 years ago
Nicolas FRANCO eacd8f1aa2 front controlleur fait, voir si catch est bon
2 years ago
Nicolas FRANCO 5076f7848f debut font controlleur
2 years ago
Nicolas FRANCO 1508f6b416 debut user controller
2 years ago
Nicolas FRANCO 1f52b95934 gtw list funcitons added + model functions
2 years ago
Nicolas FRANCO 21de950b9f verifications faites apres ajout de isDone
2 years ago
Nicolas FRANCO 362497143d verifier fonctions de gateway apres ajout de isDone
2 years ago
Nicolas FRANCO 93a3c56d12 isDone and done counter added v2
2 years ago
Nicolas FRANCO e9205a065c isDone and done counter added
2 years ago
Nicolas FRANCO a44a50eee4 minimalist list view
2 years ago
Nicolas FRANCO f70defe12d new list view
2 years ago
Nicolas FRANCO 6aed35dd16 classe modele tester
2 years ago
Nicolas FRANCO 76635d851c modele tache fait. Faire: retour fct + tests! (v2)
2 years ago
Nicolas FRANCO 7c7d1431c1 modele tache fait. Faire: retour fct + tests!
2 years ago
Nicolas FRANCO b9efb2e41a user gateway branch
2 years ago
Nicolas FRANCO c67da0780e fixed credentials
2 years ago
Nicolas FRANCO 18dc85491b db credentials update
2 years ago
Nicolas FRANCO 7716d00a9a find finit dans TaskGateway
2 years ago
Nicolas FRANCO 4ef8f2b12f TaskGateway crud functions done
2 years ago
Nicolas FRANCO d4ba442832 erreur INSERT corrigé
2 years ago
Nicolas FRANCO cc0f30d3a2 erreur sur le insert TaskGateway.php
2 years ago
Nicolas FRANCO e2009994bd test pour TaskGateway
2 years ago
Nicolas FRANCO f2841dc784 fixed task constructor
2 years ago
Nicolas FRANCO a102a64246 tests
2 years ago
Nicolas FRANCO 8fc9720265 changed branch name
2 years ago
Nicolas FRANCO cab9e77b60 dossier diagrammer + debut classe CtrlUser
2 years ago
Nicolas FRANCO 7f6b0f4bcb task gateway draf + connection test
2 years ago

@ -3,13 +3,21 @@
private int $id;
private string $nom;
private array $taches;
private $owner;
private int $dc; // done counter # juste visuelle??
function __construct($id, $taches, $owner) {
function __construct($nom, $owner="",$dc=0,$id=0) {
if($id==0)
$this->id = (int)null;
else
$this->id = $id;
$this->taches = $taches;
$this->nom = $nom;
$this->taches = [];
$this->owner = $owner;
$this->dc = 0;
}
function get_id() {
return $this->id;
}
@ -35,11 +43,22 @@
}
function get_owner() {
if($this->owner == "")
return NULL;
return $this->owner;
}
function set_owner($owner) {
$this->owner = $owner;
}
function get_dc() {
return $this->dc;
}
function set_dc($dc) {
$this->dc = $dc;
}
}
?>

@ -3,13 +3,28 @@
private int $id;
private string $titre;
private string $description;
private DateTime $dateDeb;
private DateTime $dateFin;
private $dateDeb;
private $dateFin; # $today = date("m.d.y")
private string $priorite;
function __construct($id, $titre, $description, $dateDeb, $dateFin, $priorite){
$this->titre = $titre;
$this->description = $description;
private string $idlist; // # id associating task to list
private bool $isDone; // # si la tache est complete
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_titre($titre);
$this->set_description($description);
$this->set_priorite($priorite);
$this->set_dateDeb($dateDeb);
$this->set_dateFin($dateFin);
$this->set_idlist($idl);
$this->set_isDone($isDone);
}
function get_id() {
@ -59,5 +74,22 @@
function set_priorite($priorite) {
$this->priorite = $priorite;
}
// # getter et setter pour idList
function get_idList() {
return $this->idList;
}
function set_idList($idList) {
$this->idList = $idList;
}
function get_isDone() {
return $this->isDone;
}
function set_isDone($isDone) {
$this->isDone = $isDone;
}
}
?>

@ -1,6 +1,6 @@
<?php
class User{
private string $login;
private string $login; // botar um id no final se der tempo
function __construct($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
//gen
require('dal/Connection.php');
$rep=__DIR__.'/../';
require('dal/Connection.php');
$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'achanger');
//$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', '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,39 +0,0 @@
<?php
class CtrlUser{
function __construct(){
global $vues;
$rep=__DIR__.'/../';
$dVueEreur = 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,3 +1,45 @@
<?php
require_once("config/config.php");
require("model/UserModel.php");
class FrontCtrl
{
private UserModel $usrMdl;
private $action_User;
private bool $isUser;
private $TabVues;
function __construct(&$con, $TabVues){
session_start();
$this->TabVues = $TabVues;
$this->usrMdl = new UserModel($con);
$this->action_User = array('deconnecter', 'voirListePriv', 'creerListePriv', 'supprimerListePriv');
try{
$this->isUser = $this->usrMdl->isConnected();
$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
require("VisitorCtrl.php");
$visitCtrl = new VisitorCtrl($con, $this->TabVues, $this->isUser);
$visitCtrl->goconnexion();
} else { # sinon
# handle action avec controlleur user
require("UserCtrl.php");
$userCtrl = new UserCtrl($con, $this->TabVues);
}
} else { # sinon forcement action visiteur
# appel controlleur visiteur avec l'action
require("VisitorCtrl.php");
$visitCtrl = new VisitorCtrl($con, $this->TabVues, $this->isUser);
}
} catch (Exception $e){ // verifier si catch bon
$TMessage[] = $e->getMessage();
require($this->TabVues["erreur"]);
}
}
}
?>

@ -0,0 +1,77 @@
<?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;
// supprimer une liste privee
case 'supprimerListePriv':
$this->erasePrivList();
break;
case 'deconnecter':
$this->deconnexion();
break;
default:
$TMessage[] = 'Unexpected error';
require($this->TabVues["erreur"]);
break;
}
} catch(Exception $e) {
$TMessage[] = $e->getMessage();
require($this->TabVues["erreur"]);
}
}
public function loadListePriv(){
$user = $_SESSION['login'];
$private_lists = $this->taskModel->loadPrivateLists($user);
require($this->TabVues["prives"]);
}
public function newListPrivate(){
$this->taskModel->addList($_POST['listName'],$_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");
}
}
?>

@ -0,0 +1,191 @@
<?php
require("model/TaskModel.php");
class VisitorCtrl
{
private $taskModel;
private $userModel;
private $isUser;
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{
if(isset($_REQUEST['action']))
$action = $_REQUEST['action'];
else
$action = null;
switch($action){
case null:
$this->loadHome();
# initialize la page home avec tout les listes
break;
case 'pageConnection':
$this->go_connection();
break;
case 'pageAbout':
$this->go_about();
break;
case 'connecter':
$this->connection();
# charge la vue de connexion
break;
case 'pageRegister':
$this->go_register();
break;
case 'register':
$this->register();
# charge la vue de connexion
break;
case 'pageListe':
$this->go_list();
break;
case 'creerListe':
$this->makeList();
# creer une liste publique
break;
case 'supprimerListe':
$this->eraseList();
# supprime une liste publique
break;
case 'pageTache':
$this->go_task();
break;
case 'ajouterTache':
$this->addTask();
# ajouter une tache a une liste pub
break;
case 'supprimerTache':
$this->eraseTask();
# supprimer une tache
break;
case 'isDone':
$this->isDone();
break;
default:
$TMessage[] = 'Unexpected error';
require($this->TabVues["erreur"]);
$this->loadHome();
break;
}
} catch (Exception $e) {
var_dump($_POST);
$TMessage[] = $e->getMessage();
require($this->TabVues["erreur"]);
}
}
function loadHome(){
$public_lists = $this->taskModel->loadPublicLists();
# le if suivant est nécéssaire dans le cas ou l'action
# connection a été appeller. Dans ce cas, loadHome doit
# prendre en compte le user qui vient d'être ajouter a
# $_SESSION['login']
if(isset($_SESSION['login']) && $_SESSION['login'] != "")
$user = $_SESSION['login'];
else
$user = $this->isUser;
require($this->TabVues["home"]);
}
function go_connection(){
$user = $this->isUser;
require($this->TabVues["connection"]);
}
function go_about(){
$user = $this->isUser;
require($this->TabVues["about"]);
}
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 register(){
$this->userModel->ajouter($_POST['username'],$_POST['password']);
$this->go_connection();
}
function go_list(){
$user = $this->isUser;
require("view/newList.php");
}
function makeList(){
$this->taskModel->addList($_POST['listName']);
$this->loadHome();
}
function eraseList(){
$this->taskModel->supList($_POST['listId']);
$this->loadHome();
}
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(){
$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(){
$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,33 +1,31 @@
<?php
class Connection extends PDO {
class Connection extends PDO {
private $stmt;
private $stmt;
public function __construct(string $dsn, string $username, string $password) {
public function __construct(string $dsn, string $username, string $password) {
parent::__construct($dsn,$username,$password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
parent::__construct($dsn,$username,$password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/** * @param string $query
/**
* @param string $query
* @param array $parameters *
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []) : bool{
*/
public function executeQuery(string $query, array $parameters = []) : bool{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
}
public function getResults() : array {
public function getResults() : array {
return $this->stmt->fetchall();
}
}
}
}
?>

@ -0,0 +1,185 @@
<?php
require_once("business/ListTask.php");
include_once("business/Task.php");
class TaskGateway
{
// connection attribute
public Connection $con;
// constructor
public function __construct(Connection $con){
$this->con=$con;
}
// functions
// code de retour pour les fonctions i,u,d?
public function insertT(Task $t){
$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(
':id'=> array($t->get_id(),PDO::PARAM_STR),
':titre'=> array($t->get_titre(),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),
':idList'=> array($t->get_idList(),PDO::PARAM_STR) ));
}
public function update($table,$id,$element, $valeur){
if($table == 'task'){
$query='UPDATE Tache SET '.$element.'=:'.$element.' WHERE id=:id';
} else {
$query='UPDATE uList SET '.$element.'=:'.$element.' WHERE id=:id';
}
$this->con->executeQuery($query, array(
':id'=>array($id,PDO::PARAM_STR),
':'.$element =>array($valeur,PDO::PARAM_STR)));
}
public function delete($table,$id){
if($table == 'task'){
$query='DELETE FROM Tache WHERE id = :id';
} else {
$query='DELETE FROM uList WHERE id = :id;
DELETE FROM Tache WHERE idList = :id;';
}
$this->con->executeQuery($query, array(
':id'=>array($id,PDO::PARAM_STR)));
}
/*si on veut trouver une liste, juste chercher toutes les taches avec idList= id_de_la_liste*/
# pour toutes les listes d'un user specifique, appeller 2 fois la fonction:
# une fois pour prendre toutes les listes qui ont l'id de l'user
# pour toutes ces listes (foreach), find toutes chaque tache associé
public function find($table, $element="", $valeur=""){
$tabResult = array();
if($table =='task'){
if(strcmp($element,"")==0)
{
$query='SELECT * FROM Tache';
$this->con->executeQuery($query);
}
else
{
$query='SELECT * FROM Tache WHERE '.$element.'=:'.$element;
$this->con->executeQuery($query, array(
':'.$element =>array($valeur,PDO::PARAM_STR)));
}
$results=$this->con->getResults();
foreach($results as $row)
{
$tabTaches[]=new Task($row['titre'],$row['description'],$row['priorite'],
$row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone'],$row['id']);
}
return $tabResult;
} else if($table == 'list'){
if(strcmp($element,"")==0)
{
$query='SELECT * FROM uList';
$this->con->executeQuery($query);
}
else
{
$query='SELECT * FROM uList WHERE '.$element.'=:'.$element;
$this->con->executeQuery($query, array(
':'.$element =>array($valeur,PDO::PARAM_STR)));
}
$results=$this->con->getResults();
foreach($results as $row)
{
$tabList[]=new ListTask($row['nom'],$row['user'],$row['dc'],$row['id']);
}
return $tabResult;
}
}
// SELECT tache.id FROM Tache tache, Liste liste
// tache.idListe = liste.id AND liste.user IS NULL;
/* # LIST FUNCTIONS */
/*create, update, delete, read(select info)*/
public function insertL(ListTask $l){
$query='INSERT INTO uList VALUES (:id,:nom,:user,0)';
$this->con->executeQuery($query, array(
':id'=> array($l->get_id(),PDO::PARAM_STR),
':nom'=> array($l->get_nom(),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;
}
}
?>

@ -2,7 +2,7 @@
// password_hash
// password_verify
class GatUser{
class UserGateway{
private $con;
public function __construct(Connection $con) {
@ -44,12 +44,12 @@
}
public function findUser($login, $mdp){
$pwrd = password_hash($mdp, PASSWORD_BCRYPT, array("cost" => 12));
$query = 'SELECT login FROM User WHERE login = :login AND mdp = :mdp';
$this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR),
':mdp'=>array($pwrd, PDO::PARAM_STR)));
$query = 'SELECT mdp FROM User WHERE login = :login';
$this->con->executeQuery($query, array(':login'=>array($login, PDO::PARAM_STR)));
$result = $this->con->getResults();
return $result;
if(empty($result[0][0])) return;
if(password_verify($mdp, $result[0][0]))
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;

File diff suppressed because it is too large Load Diff

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

@ -1,63 +0,0 @@
<?php
require('../business/User.php');
class ModelUser{
private $con;
private $gat;
public function __construct(Connection $con) {
$this->con = $con;
$this->gat = new GatUser($con); }
function connexion($login, $mdp){
$gat->findUser($login, $mdp);
$_SESSION['login'] = $login;
}
function deconnexion(){
session_unset();
session_destroy();
$_SESSION = array();
}
function isConnected($login){ //teste rôle dans la session, retourne instance dobjet ou booleen
if (isset($_SESSION['login']))
{
return true;
}
else return false;
}
function ajouter($login, $mdp){
$user = $this->findByLogin($login);
if (empty($user))
$this->gat->create($login, $mdp);
}
function supprimer($login){
$this->gat->delete($login);
}
function modifMdp($login, $mdp){
$this->gat->updateMdp($login, $mdp);
}
function findByLogin($login){
$user = null;
if ($login !== " " && $login != null )
{
$results = $this->gat->find($login, 'login');
foreach($results as $row){
$user = new User($results['login']);
}
return $user;
}
}
function modifLogin($oldLogin, $newLogin){
$user = $this->findByLogin($oldLogin);
if (empty($user))
$this->gat->updateLogin($oldLogin, $newLogin);
}
}
?>

@ -0,0 +1,88 @@
<?php
include_once("dal/TaskGateway.php");
include_once("business/Task.php");
class TaskModel
{
public Connection $con;
public TaskGateway $gtw;
public function __construct(Connection $con)
{
$this->con=$con;
$this->gtw= new TaskGateway($con);
}
public function addTask($titre,$desc,$priorite,$idList,$dateDeb=null,$dateFin=null,$isDone=false,$id=0)
{
$t = new Task($titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone,$id);
$this->gtw->insertT($t);
// retourne quoi? con->lastInsertId() ??
}
public function supTask($id)
{
$this->gtw->delete('task',$id);
}
public function modifTask($id,$element,$valeur)
{
$this->gtw->update('task',$id,$element,$valeur);
}
public function getAllTask()
{
return $this->gtw->find('task');
}
public function getTaskBy($element,$valeur)
{
return $this->gtw->find('task',$element,$valeur);
}
/* LIST FUNCTIONS */
public function addList($nom,$owner="",$dc=0,$id=0)
{
Validation::val_form_texte($owner, $TMessage);
$l = new ListTask($nom,$owner,$dc);
$this->gtw->insertL($l);
// retourne quoi? con->lastInsertId() ??
}
public function modifList($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)
{
$this->gtw->delete('list',$id);
}
function loadPublicLists()
{
$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;
}
}
?>

@ -0,0 +1,82 @@
<?php
require('business/User.php');
require('dal/UserGateway.php');
require_once("config/config.php");
class UserModel{
private $con;
private $gat;
public function __construct(Connection $con) {
$this->con = $con;
$this->gat = new UserGateway($con);
}
function connexion($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$result = $this->gat->findUser($login, $mdp);
if(!isset($result)){
return false;
} else {
$_SESSION['login'] = $result;
return true;
}
}
function deconnexion(){
session_unset();
session_destroy();
}
function isConnected(){ //teste rôle dans la session, retourne instance dobjet ou booleen
Validation::val_form_texte($_SESSION['login'], $TMessage);
if(isset($_SESSION['login']) && $_SESSION['login']!="")
return true;
else
return false;
}
function ajouter($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$user = $this->findByLogin($login);
if (empty($user))
$this->gat->create($login, $mdp);
}
function supprimer($login){
Validation::val_form_texte($login, $TMessage);
$this->gat->delete($login);
}
function modifMdp($login, $mdp){
Validation::val_form_texte($login, $TMessage);
Validation::val_form_mdp($mdp, $TMessage);
$this->gat->updateMdp($login, $mdp);
}
function findByLogin($login){
Validation::val_form_texte($login, $TMessage);
$user = null;
if ($login !== " " && $login != null )
{
$results = $this->gat->find($login, 'login');
foreach($results as $row){
$user = new User($results['login']);
}
return $user;
}
}
function modifLogin($oldLogin, $newLogin){
Validation::val_form_texte($oldLogin, $TMessage);
Validation::val_form_texte($newLogin, $TMessage);
$user = $this->findByLogin($oldLogin);
if (empty($user))
$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();
?>

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

@ -1,24 +0,0 @@
<?php
require('../dal/Connection.php');
require('../dal/GatUser.php');
require('../model/ModelUser.php');
$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'achanger');
// Test Gateway User
// $gat = new GatUser($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 ModelUser($con);
// $mdl->ajouter('Anna', 'unmdptrescomplique');
// $mdl->modifLogin('Anna', 'Aeryn');
// $mdl->modifMdp('Aeryn', 'wtfmec');
// $mdl->supprimer('Aeryn');
?>

@ -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 @@
<?php
<!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
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>

@ -4,7 +4,7 @@
<link rel="stylesheet" href="authentification.css">
</head>
<body>
<h1>Magnifique To do list</h1>
<h1>2do, an amazing todo list 4 you!</h1>
<form action="authentification.php" method="POST">
<label>Login</label>
<input type="text" name="login" placeholder="Saisissez votre login" required />

@ -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";
}
}

@ -0,0 +1,92 @@
<!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">
<section class="vh-50" 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 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="form-outline">
<input type="text" id="form1" class="form-control" name="listName" required/>
</div>
</div>
<button type="submit" class="btn btn-primary">Add</button>
<input type="hidden" name="action" value="creerListe"></input>
<?php
if($user){
echo '
<label for="privateRadio" class="form-check-label">
<input class="form-check-input" type="radio" name="action" value="creerListePriv"> Private &#128274
</label>';
}
?>
</form>
</div>
</div>
</div>
</div>
</div>
</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>
</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>

@ -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>
Loading…
Cancel
Save