Compare commits

...

6 Commits

@ -20,14 +20,12 @@
# Fonctionnalités # Fonctionnalités
</br>
- Visiteur : - Visiteur :
- Ajouter/Supprimer une liste publique - Ajouter/Supprimer une liste publique
- Modifier une liste publique - Modifier une liste publique
- Ajouter/Supprimer des tâches dans une liste publique - Ajouter/Supprimer des tâches dans une liste publique
- se connecter - Se connecter
- s'inscrire - S'inscrire
- Cocher une tâche d'une liste publique - Cocher une tâche d'une liste publique
- Utilisateur (en plus des fonctionnalités visiteurs) : - Utilisateur (en plus des fonctionnalités visiteurs) :
@ -37,16 +35,16 @@
- Voir son profil - Voir son profil
- Supprimer son compte (Toutes ces tâches sont aussi supprimées) - Supprimer son compte (Toutes ces tâches sont aussi supprimées)
- Modifier son mode de passe - Modifier son mode de passe
- voir ses informations (Nom/Prenom/mail/Nombre de liste privé réalisé) - voir ses informations (Nom/Prénom/mail/Nombre de liste privé réalisé)
- Cocher une tâche d'une liste privé - Cocher une tâche d'une liste privé
- Administrateur (considérer comme un utilisateur, mais avec des droits en plus) : - Administrateur (considérer comme un utilisateur, mais avec des droits en plus) :
- Voir tous les utilisateurs - Voir tous les utilisateurs
- Supprimer un utilisateur - Supprimer un utilisateur
# Repartition du Gitlab # Répartition du Gitlab
La racine de notre gitlab est composé de deux dossiers essentiels au projet: La racine de notre gitlab est composée de deux dossiers essentiels au projet:
[**src**](src) : **Toute la partie codage du site web** [**src**](src) : **Toute la partie codage du site web**
@ -72,7 +70,7 @@ Notre environnement de travail se base sur plusieurs outils :
# Technicien en charge de l'application # Technicien en charge de l'application
La composition pour le projet se voit réaliser par deux élèves de l'IUT d'aubière: La composition pour le projet se voit réaliser par deux élèves de l'IUT d'Aubière:
<br> <br>
⚙️ Emre KARTAL ⚙️ Emre KARTAL
<br> <br>

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Hôte : localhost -- Hôte : localhost
-- Généré le : ven. 16 déc. 2022 à 14:49 -- Généré le : ven. 16 déc. 2022 à 22:44
-- Version du serveur : 10.5.15-MariaDB-0+deb11u1 -- Version du serveur : 10.5.15-MariaDB-0+deb11u1
-- Version de PHP : 7.4.28 -- Version de PHP : 7.4.28
@ -60,7 +60,8 @@ CREATE TABLE `ToDoList_Admin` (
-- --
INSERT INTO `ToDoList_Admin` (`idAdmin`) VALUES INSERT INTO `ToDoList_Admin` (`idAdmin`) VALUES
(50); (50),
(58);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -74,7 +75,7 @@ CREATE TABLE `ToDoList_Liste` (
`description` varchar(200) NOT NULL, `description` varchar(200) NOT NULL,
`dateCreation` date NOT NULL, `dateCreation` date NOT NULL,
`estPublic` tinyint(1) NOT NULL, `estPublic` tinyint(1) NOT NULL,
`idUtilisateur` int(11) NOT NULL `idUtilisateur` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --
@ -82,29 +83,11 @@ CREATE TABLE `ToDoList_Liste` (
-- --
INSERT INTO `ToDoList_Liste` (`id`, `nom`, `description`, `dateCreation`, `estPublic`, `idUtilisateur`) VALUES INSERT INTO `ToDoList_Liste` (`id`, `nom`, `description`, `dateCreation`, `estPublic`, `idUtilisateur`) VALUES
(2, 'Work', 'Work', '2022-12-01', 1, 1), (124, 'Iut', 'Ma liste de devoirs', '2022-12-16', 1, 1),
(3, 'Job', 'J\'aime travailler', '2022-12-05', 1, 1), (125, 'Serie', 'Les series à regarder', '2022-12-16', 1, 1),
(4, 'Fourniture Scolaire', 'Acheter les Fournitures Scolaire avant Septembre', '2022-12-06', 1, 1), (150, 'Fourniture Scolaire', 'Mes fournitures Scolaires à acheter avant septembre', '2022-12-06', 1, NULL),
(6, 'Projet Blazor', 'Les tâches que je doit faire pour mon projet Blazor', '2022-12-06', 1, 1), (155, 'Supermarché', 'Acheter les courses au Supermarché', '2022-12-02', 1, NULL),
(7, 'SAE', 'Les tâches à faire pour la SAE', '2022-12-06', 1, 1), (156, 'Ordinateur', 'Les composants pour mon ordinateur', '2022-12-03', 1, NULL);
(8, 'Supermarché', 'Acheter les courses au Supermarché', '2022-12-02', 1, 1),
(9, 'Voiture', 'Liste des choses à acheter pour ma voiture', '2022-12-01', 1, 1),
(11, 'Ordinateur', 'Les composants pour mon ordinateur', '2022-12-03', 1, 1),
(13, 'Test List', '', '2022-12-01', 1, 1),
(14, 'Test List 2', 'hahaa', '2022-12-02', 1, 1),
(40, 'TestList1', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', '2022-12-15', 1, 49),
(41, 'TestList2', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', '2022-12-14', 1, 1),
(42, 'TestList3', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', '2022-12-15', 1, 49),
(43, 'TestList4', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ', '2022-12-15', 1, 49),
(44, 'Montre', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-12', 1, 1),
(45, 'Glace', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-13', 1, 49),
(46, 'Trotinette', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-15', 0, 49),
(47, 'Csharp', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-14', 1, 1),
(48, 'Book', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-15', 1, 49),
(49, 'Telephone', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-10', 1, 1),
(50, 'Clavier', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-13', 1, 49),
(51, 'Méthodes d\'optimisation', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-07', 1, 49),
(52, 'Casque', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', '2022-12-07', 1, 49);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -126,15 +109,11 @@ CREATE TABLE `ToDoList_Tache` (
-- --
INSERT INTO `ToDoList_Tache` (`id`, `nom`, `description`, `dateCreation`, `estValide`, `idListe`) VALUES INSERT INTO `ToDoList_Tache` (`id`, `nom`, `description`, `dateCreation`, `estValide`, `idListe`) VALUES
(1, 'PHP', 'Finir le projet de PHP et les TPs', '2022-12-06', 0, 2), (139, 'Blazor', 'Finir le projet', '2022-12-16', 0, 124),
(2, 'Blazor', 'Finir le projet de Blazor', '2022-12-06', 1, 2), (140, 'Sae', 'Faire le rapport', '2022-12-16', 1, 124),
(3, 'Stage', 'Postuler chez CGI et Apside', '2022-12-06', 0, 3), (141, 'Breaking Bad', 'Le top 1', '2022-12-16', 0, 125),
(4, 'CV', 'Finir le CV', '2022-12-06', 1, 3), (142, 'The Walking Dead', 'Meme si apres la saison 7 cest pas ouf', '2022-12-16', 0, 125),
(5, 'Push', 'rayhan faut penser a push ton taff', '2022-12-06', 1, 6), (145, 'ProgSys', 'Finir le tp', '2022-12-16', 0, 124);
(6, 'Etre le goat', 'je suis le goat', '2022-12-06', 0, 7),
(7, 'Acheter le lait ', 'parce que il faut faire comme papa', '2022-12-06', 1, 8),
(8, 'Acheter des stylos', 'parce que Arthur en a pas', '2022-12-06', 0, 4),
(9, 'Réviser prog sys', 'Je suis dans la caca', '2022-12-06', 0, 3);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -157,8 +136,10 @@ CREATE TABLE `ToDoList_Utilisateur` (
INSERT INTO `ToDoList_Utilisateur` (`id`, `nom`, `prenom`, `pseudo`, `email`, `motDePasse`) VALUES INSERT INTO `ToDoList_Utilisateur` (`id`, `nom`, `prenom`, `pseudo`, `email`, `motDePasse`) VALUES
(1, 'Kartal', 'Emre', 'Malleo', 'emre.kartal10@etu.uca.fr', '00000'), (1, 'Kartal', 'Emre', 'Malleo', 'emre.kartal10@etu.uca.fr', '00000'),
(49, 'Khedair', 'Rami', 'Rori63', 'rami.khedair@etu.uca.fr', '$2y$10$aqRyoGoXN9dxpGPsMYTNY.gkSDZwsIwORfb78HqleiuV3PvwQ75iO'), (50, 'Rayhan', 'Hassou', 'rayhan', 'hassourayhan1@gmail.com', '$2y$10$cKfV6KB7siPhwMRbpoS/COMaZQKkYETj.HIQ5YWkrbc5qXo.9jvuK'),
(50, 'Rayhan', 'Hassou', 'rayhan', 'hassourayhan1@gmail.com', '$2y$10$D0sJ14i8bDdigDZZx1VLguWbviCbVw5cAQkwD/ja336MD3E2tFEH6'); (51, 'Lucas', 'Mielkarek', 'lukaka', 'lucas@gmail.com', '$2y$10$5AlX0WcLx.8r/WCxxcBeuOaeGTzftqk3jn9q2cKMZkft313y2a3.C'),
(57, 'Restitutio', 'Mathieu', 'marestituito', 'Matthieu.RESTITUITO@uca.fr', '$2y$10$RNj8XMe5UDWDuiocwwg.g../8powrKKNpQ1FmPzSBoN9JubfjYrIq'),
(58, 'Admin', 'Prof', 'Admin', 'Matthieu.RESTITUITO@admin.fr', '$2y$10$oE5jSXemC4NrKiQE9EUKYeO1RdTpbeXxj/FaayeVciBQxYdxsmNuW');
-- --
-- Index pour les tables déchargées -- Index pour les tables déchargées
@ -212,19 +193,19 @@ ALTER TABLE `MaTable`
-- AUTO_INCREMENT pour la table `ToDoList_Liste` -- AUTO_INCREMENT pour la table `ToDoList_Liste`
-- --
ALTER TABLE `ToDoList_Liste` ALTER TABLE `ToDoList_Liste`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=157;
-- --
-- AUTO_INCREMENT pour la table `ToDoList_Tache` -- AUTO_INCREMENT pour la table `ToDoList_Tache`
-- --
ALTER TABLE `ToDoList_Tache` ALTER TABLE `ToDoList_Tache`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=152;
-- --
-- AUTO_INCREMENT pour la table `ToDoList_Utilisateur` -- AUTO_INCREMENT pour la table `ToDoList_Utilisateur`
-- --
ALTER TABLE `ToDoList_Utilisateur` ALTER TABLE `ToDoList_Utilisateur`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
-- --
-- Contraintes pour les tables déchargées -- Contraintes pour les tables déchargées

@ -10,14 +10,25 @@ RewriteEngine On
# Règles de réécriture d'url # Règles de réécriture d'url
#--------------------------------- #---------------------------------
# Visiteur
RewriteRule ^login$ index.php?action=redirectionLogin [L] RewriteRule ^login$ index.php?action=redirectionLogin [L]
RewriteRule ^inscription$ index.php?action=redirectionInscription [L] RewriteRule ^inscription$ index.php?action=redirectionInscription [L]
RewriteRule ^VueListePublic$ index.php?action=redirectionListePublic [L] RewriteRule ^VueListePublic$ index.php?action=redirectionListePublic [L]
RewriteRule ^previousPage$ index.php?action=pagePrécédente [L]
RewriteRule ^nextPage$ index.php?action=pageSuivante [L]
RewriteRule ^check$ index.php?action=check [L]
# Utilisateur
RewriteRule ^logout$ index.php?action=logout [L] RewriteRule ^logout$ index.php?action=logout [L]
RewriteRule ^MonProfil$ index.php?action=redirectionProfil [L] RewriteRule ^MonProfil$ index.php?action=redirectionProfil [L]
RewriteRule ^supprimerCompte$ index.php?action=supprimerCompte [L] RewriteRule ^supprimerCompte$ index.php?action=supprimerCompte [L]
RewriteRule ^previousPage$ index.php?action=pagePrécédente [L]
RewriteRule ^nextPage$ index.php?action=pageSuivante [L]
RewriteRule ^Users$ index.php?action=voirUser [L]
RewriteRule ^listePrive$ index.php?action=listePrive [L] RewriteRule ^listePrive$ index.php?action=listePrive [L]
RewriteRule ^previousPagePrive$ index.php?action=pagePrécédentePrive [L]
RewriteRule ^nextPagePrive$ index.php?action=pageSuivantePrive [L]
RewriteRule ^checkPrive$ index.php?action=checkPrive [L]
# Admin
RewriteRule ^users$ index.php?action=redirectionVueUtilisateur [L] RewriteRule ^users$ index.php?action=redirectionVueUtilisateur [L]

@ -91,7 +91,7 @@ class Validation {
} }
static function cleanText(string &$txt) { static function cleanText(string &$txt) {
$txt = preg_replace('/[^A-Za-z\-\^0-9\ ]/', '', $txt); $txt = preg_replace('/[^A-Za-z\-\^0-9\ \à\é\^]/', '', $txt);
if($txt == null || $txt == '') if($txt == null || $txt == '')
{ {
return null; return null;

@ -16,9 +16,8 @@ class CtrlUtilisateur {
switch($action) { switch($action) {
case NULL: case NULL:
$this->ConsulterListePublic($dVueErreur); $this->ConsulterListePrive($dVueErreur);
break; break;
case "logout": case "logout":
@ -65,6 +64,14 @@ class CtrlUtilisateur {
$this->SupprimerListePrive($dVueErreur); $this->SupprimerListePrive($dVueErreur);
break; break;
case "pagePrécédentePrive":
$this->listePrécédente($dVueErreur);
break;
case "pageSuivantePrive":
$this->listeSuivante($dVueErreur);
break;
default: default:
$dVueErreur[] = "Erreur d'appel php"; $dVueErreur[] = "Erreur d'appel php";
require ($rep.$vues['erreur']); require ($rep.$vues['erreur']);
@ -89,14 +96,6 @@ class CtrlUtilisateur {
exit(0); exit(0);
}//fin constructeur }//fin constructeur
function ConsulterListePublic(array $dVueErreur) {
global $rep,$vues;
$listes = MdlVisiteur::RecupererListePublic();
$taches = MdlVisiteur::RecupererTache();
$action=NULL;
require ($rep.$vues['listPublic']);
}
function SeDeconnecter(array $dVueErreur){ function SeDeconnecter(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
MdlUtilisateur::déconnexion(); MdlUtilisateur::déconnexion();
@ -137,20 +136,20 @@ class CtrlUtilisateur {
function ConsulterListePrive(array $dVueErreur) { function ConsulterListePrive(array $dVueErreur) {
global $rep,$vues; global $rep,$vues;
$listesPrive = MdlUtilisateur::RecupererListePrive(); $listesPrive = MdlUtilisateur::RecupererListePrive();
$taches = MdlVisiteur::RecupererTache(); $taches = MdlUtilisateur::RecupererTache();
$action=NULL; $action=NULL;
require ($rep.$vues['listPrive']); require ($rep.$vues['listPrive']);
} }
function SupprimerTachePrive(array $dVueErreur){ function SupprimerTachePrive(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
$tache = MdlVisiteur::SupprimerTache(); $tache = MdlUtilisateur::SupprimerTache();
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
function SupprimerListePrive(array $dVueErreur){ function SupprimerListePrive(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
$liste = MdlVisiteur::SupprimerListe(); $liste = MdlUtilisateur::SupprimerListe();
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
@ -158,14 +157,14 @@ class CtrlUtilisateur {
public function AjouterTachePrive(array $dVueErreur){ public function AjouterTachePrive(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
try{ try{
$tache = MdlVisiteur::AjouterTache($dVueErreur); $tache = MdlUtilisateur::AjouterTache($dVueErreur);
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
catch (Exception $e) catch (Exception $e)
{ {
$ErreurLog=$e->getMessage(); $ErreurLog=$e->getMessage();
$listesPrive= MdlUtilisateur::RecupererListePrive(); $listesPrive= MdlUtilisateur::RecupererListePrive();
$taches = MdlVisiteur::RecupererTache(); $taches = MdlUtilisateur::RecupererTache();
$action=NULL; $action=NULL;
require ($rep.$vues['listPrive']); require ($rep.$vues['listPrive']);
} }
@ -175,24 +174,23 @@ class CtrlUtilisateur {
public function ModifierListePrive(array $dVueErreur){ public function ModifierListePrive(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
try{ try{
$tache = MdlVisiteur::ModifierListe($dVueErreurs); $tache = MdlUtilisateur::ModifierListe($dVueErreur);
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
catch (Exception $e) catch (Exception $e)
{ {
$ErreurLog=$e->getMessage(); $ErreurLog=$e->getMessage();
$listesPrive= MdlUtilisateur::RecupererListePrive(); $listesPrive= MdlUtilisateur::RecupererListePrive();
$taches = MdlVisiteur::RecupererTache(); $taches = MdlUtilisateur::RecupererTache();
$action=NULL; $action=NULL;
require ($rep.$vues['listPublic']); require ($rep.$vues['listPublic']);
} }
} }
public function checkPrive(array $dVueErreur)
public function checkPrive()
{ {
global $rep,$vues; global $rep,$vues;
$tache = MdlVisiteur::check(); $tache = MdlUtilisateur::check();
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
@ -207,23 +205,21 @@ class CtrlUtilisateur {
{ {
$ErreurLog=$e->getMessage(); $ErreurLog=$e->getMessage();
$listes = MdlUtilisateur::RecupererListePrive(); $listes = MdlUtilisateur::RecupererListePrive();
$taches = MdlVisiteur::RecupererTache(); $taches = MdlUtilisateur::RecupererTache();
$action=NULL; $action=NULL;
require ($rep.$vues['listPrive']); require ($rep.$vues['listPrive']);
} }
} }
public function listePrécédente(array $dVueErreur){ public function listePrécédente(array $dVueErreur){
if($_COOKIE['pageUser'] > 1){ if($_SESSION['pageUser'] > 1){
setcookie('pageUser', $_COOKIE['pageUser'] - 1, time() + 24*3600); $_SESSION['pageUser']=$_SESSION['pageUser']-1;
} }
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }
public function listeSuivante(array $dVueErreur){ public function listeSuivante(array $dVueErreur){
setcookie('pageUser', $_COOKIE['pageUser'] + 1, time() + 24*3600); $_SESSION['pageUser']=$_SESSION['pageUser']+1;
$this->ConsulterListePrive($dVueErreur); $this->ConsulterListePrive($dVueErreur);
} }

@ -160,10 +160,7 @@ class CtrlVisiteur {
function SupprimerListe(array $dVueErreur){ function SupprimerListe(array $dVueErreur){
global $rep,$vues; global $rep,$vues;
$liste = MdlVisiteur::SupprimerListe(); $liste = MdlVisiteur::SupprimerListe();
$listes = MdlVisiteur::RecupererListePublic(); $this->ConsulterListePublic($dVueErreur);
$taches = MdlVisiteur::RecupererTache();
$action=NULL;
require ($rep.$vues['listPublic']);
} }
public function AjouterTache(array $dVueErreur){ public function AjouterTache(array $dVueErreur){
@ -223,14 +220,14 @@ class CtrlVisiteur {
} }
public function listePrécédente(array $dVueErreur){ public function listePrécédente(array $dVueErreur){
if($_COOKIE['page']>1){ if($_SESSION['page'] > 1){
setcookie('page', $_COOKIE['page'] - 1, time() + 24*3600); $_SESSION['page']=$_SESSION['page']-1;
} }
$this->ConsulterListePublic($dVueErreur); $this->ConsulterListePublic($dVueErreur);
} }
public function listeSuivante(array $dVueErreur){ public function listeSuivante(array $dVueErreur){
setcookie('page', $_COOKIE['page'] + 1, time() + 24*3600); $_SESSION['page']=$_SESSION['page']+1;
$this->ConsulterListePublic($dVueErreur); $this->ConsulterListePublic($dVueErreur);
} }

@ -4,17 +4,18 @@ class FrontControleur {
function __construct(){ function __construct(){
global $rep,$vues; global $rep,$vues;
session_start(); session_start();
if(!isset($_COOKIE['page'])){ if(!isset($_SESSION["pageUser"])){
setcookie('page', 1, time() + 24*3600); $_SESSION['pageUser']=1;
} }
if(!isset($_COOKIE['pageUser'])){ if(!isset($_SESSION["page"])){
setcookie('pageUser', 1, time() + 24*3600); $_SESSION['page']=1;
} }
try { try {
$string_actor=' '; $string_actor=' ';
$listeActions=array( $listeActions=array(
'Utilisateur' => array('logout','redirectionProfil','supprimerCompte', 'listePrive','AjouterListePrive', 'SupprimerListePrive', 'AjouterTachePrive', 'ModifierListePrive', 'SupprimerTachePrive'), 'Utilisateur' => array('logout','redirectionProfil','pageSuivantePrive','pagePrécédentePrive','supprimerCompte','modifMdp' ,'listePrive','AjouterListePrive', 'checkPrive', 'SupprimerListePrive', 'AjouterTachePrive', 'ModifierListePrive', 'SupprimerTachePrive'),
'Admin' => array('redirectionVueUtilisateur','SupprimerUtilisateur') 'Admin' => array('redirectionVueUtilisateur','SupprimerUtilisateur')
); );

@ -54,6 +54,26 @@ class MdlUtilisateur
return $listeGtw->CountListe(intval($id)); return $listeGtw->CountListe(intval($id));
} }
public function ModifierListe(&$dVueErreur){
$userGtw = new ListeGateway();
$id = $_POST['idListe'];
$nom = Validation::cleanText($_POST['nom-modif-liste']);
$description = Validation::cleanText($_POST['description-modif-liste']);
if($nom == NULL && $description==null){
return null;
}
if($description == NULL){
$userGtw->EditerNom($id, $nom);
}
else if($nom == NULL){
$userGtw->EditerDescription($id, $description);
}
else{
$userGtw->Editer($id, $nom, $description);
}
}
public static function suppressionUtilisateur(){ public static function suppressionUtilisateur(){
$userGtw = new UtilisateurGateway(); $userGtw = new UtilisateurGateway();
@ -84,22 +104,55 @@ class MdlUtilisateur
} }
public function AjouterListePrive(&$dVueErreur){ public static function AjouterListePrive(&$dVueErreur){
$taskGtw = new ListeGateway(); $listGtw = new ListeGateway();
$nom=$_POST['nom-ajout-liste']; $nom=$_POST['nom-ajout-liste'];
$description=$_POST['description-ajout-liste']; $description=$_POST['description-ajout-liste'];
$idCreateur =Validation::cleanInt($_SESSION['id']); $idCreateur =Validation::cleanInt($_SESSION['id']);
Validation::val_form_add($nom,$description,$dVueErreur); Validation::val_form_add($nom,$description,$dVueErreur);
$taskGtw->Ajouter($nom, $description,0, $idCreateur); $listGtw->Ajouter($nom, $description,0, $idCreateur);
} }
public static function RecupererListePrive(){ public static function RecupererListePrive(){
$userGtw = new ListeGateway(); $listeGtw = new ListeGateway();
if(isset($_COOKIE["page"])) if(isset($_SESSION["pageUser"]))
return $userGtw->getListePublic(($_COOKIE["page"]-1)*10,10); return $listeGtw->getListePrive(($_SESSION["pageUser"]-1)*5,5);
else else
return $userGtw->getListePublic(1,10); return $listeGtw->getListePrive(1,10);
} }
public static function RecupererTache(){
$taskGtw = new TacheGateway();
return $taskGtw->getTache();
}
public static function SupprimerListe(){
$listeGtw = new ListeGateway();
$taskGtw = new TacheGateway();
$id = $_GET['idListe'];
$taskGtw->SupprimerViaListe($id);
$listeGtw->Supprimer($id);
}
public static function check(){
$taskGtw = new TacheGateway();
$id = $_POST['idTache'];
$taskGtw->isDone($id);
}
public static function SupprimerTache(){
$taskGtw = new TacheGateway();
$id = $_GET['idTache'];
$taskGtw->Supprimer($id);
}
public function AjouterTache(&$dVueErreur){
$taskGtw = new TacheGateway();
$id = $_POST['idListe'];
$nom = $_POST['nom-ajout'];
$description = $_POST['description-ajout'];
Validation::val_form_add($nom,$description,$dVueErreur);
$taskGtw->AjouterTache($nom, $description,false,$id);
}
} }

@ -17,30 +17,30 @@ class MdlVisiteur
} }
public static function RecupererListePublic(){ public static function RecupererListePublic(){
$userGtw = new ListeGateway(); $listGtw = new ListeGateway();
if(isset($_COOKIE["page"])) if(isset($_SESSION["page"]))
return $userGtw->getListePublic(($_COOKIE["page"]-1)*10,10); return $listGtw->getListePublic(($_SESSION["page"]-1)*5,5);
else else
return $userGtw->getListePublic(1,10); return $listGtw->getListePublic(1,10);
} }
public static function RecupererTache(){ public static function RecupererTache(){
$userGtw = new TacheGateway(); $taskGtw = new TacheGateway();
return $userGtw->getTache(); return $taskGtw->getTache();
} }
public static function SupprimerTache(){ public static function SupprimerTache(){
$userGtw = new TacheGateway(); $taskGtw = new TacheGateway();
$id = $_GET['idTache']; $id = $_GET['idTache'];
$userGtw->Supprimer($id); $taskGtw->Supprimer($id);
} }
public static function SupprimerListe(){ public static function SupprimerListe(){
$userGtw = new ListeGateway(); $listGtw = new ListeGateway();
$taskGtw = new TacheGateway(); $taskGtw = new TacheGateway();
$id = $_GET['idListe']; $id = $_GET['idListe'];
$taskGtw->SupprimerViaListe($id); $taskGtw->SupprimerViaListe($id);
$userGtw->Supprimer($id); $listGtw->Supprimer($id);
} }
public function AjouterTache(&$dVueErreur){ public function AjouterTache(&$dVueErreur){
@ -53,19 +53,22 @@ public static function RecupererListePublic(){
} }
public function ModifierListe(&$dVueErreur){ public function ModifierListe(&$dVueErreur){
$userGtw = new ListeGateway(); $listGtw = new ListeGateway();
$id = $_POST['idListe']; $id = $_POST['idListe'];
$nom = Validation::cleanText($_POST['nom-modif-liste']); $nom = Validation::cleanText($_POST['nom-modif-liste']);
$description = Validation::cleanText($_POST['description-modif-liste']); $description = Validation::cleanText($_POST['description-modif-liste']);
if($nom == NULL && $description==null){
return null;
}
if($description == NULL){ if($description == NULL){
$userGtw->EditerNom($id, $nom); $listGtw->EditerNom($id, $nom);
} }
else if($nom == NULL){ else if($nom == NULL){
$userGtw->EditerDescription($id, $description); $listGtw->EditerDescription($id, $description);
} }
else{ else{
$userGtw->Editer($id, $nom, $description); $listGtw->Editer($id, $nom, $description);
} }
} }
@ -77,9 +80,9 @@ public static function RecupererListePublic(){
$listGtw->Ajouter($nom, $description,1, 1); $listGtw->Ajouter($nom, $description,1, 1);
} }
public function check(){ public static function check(){
$taskGtw = new TacheGateway(); $taskGtw = new TacheGateway();
$id = $_POST['idTache']; $id = Validation::cleanInt($_POST['idTache']);
$taskGtw->isDone($id); $taskGtw->isDone($id);
} }

@ -47,13 +47,6 @@ class ListeGateway{
$this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT))); $this->con->executeQuery($query,array('id' => array($id, PDO::PARAM_INT)));
} }
public function getListe(int $offset, int $limit){
$query = "SELECT * FROM ToDoList_Liste LIMITS $offset,$limit";
$this->con->executeQuery($query);
$listes=$this->con->getResults();
return $listes;
}
public function getListePublic($offset,$limit){ public function getListePublic($offset,$limit){
$query = "SELECT * FROM ToDoList_Liste WHERE estPublic LIMIT $offset, $limit"; $query = "SELECT * FROM ToDoList_Liste WHERE estPublic LIMIT $offset, $limit";
$this->con->executeQuery($query); $this->con->executeQuery($query);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

@ -26,7 +26,6 @@ body::before {
z-index: -1; z-index: -1;
} }
/* Model */ /* Model */
.model { .model {

@ -16,6 +16,11 @@
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
} }
</style> </style>
<div class="custom-control custon-switch mr-5">
<input type="checkbox" class="custom-control-input" id="selector">
<label class="custom-control-label" for="selector">Dark Mode</label>
</input>
</div>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<?php <?php
if(isset($_SESSION['id'])){ ?> if(isset($_SESSION['id'])){ ?>

@ -74,6 +74,19 @@
$total = 0; $total = 0;
?> ?>
<!-- Modifier couleur -->
<script>
$(document).ready(function(){
$("#selector").change(function(){
$("body").toggleClass("bg-secondary");
$("nav").toggleClass("navbar-dark bg-dark");
$(".custom-control-label").toggleClass("text-white");
});
});
</script>
<!-- Affichage des listesPrive --> <!-- Affichage des listesPrive -->
<div class="container py-2 h-100"> <div class="container py-2 h-100">
@ -200,7 +213,7 @@
$total = $total + 1; $total = $total + 1;
?> ?>
<li class="list-group-item border-0 d-flex align-items-center ps-0"> <li class="list-group-item border-0 d-flex align-items-center ps-0">
<form name="action" action="index.php?action=checkPrive" method="POST"> <form name="action" action="checkPrive" method="POST">
<input class="form-check-input me-3" id="task-<?= $tache->getId() ?>" type="checkbox" onChange="submit();" <input class="form-check-input me-3" id="task-<?= $tache->getId() ?>" type="checkbox" onChange="submit();"
<?php if($tache->getEstValide() == 1) echo "checked" ?>> <?php if($tache->getEstValide() == 1) echo "checked" ?>>
<label for="task-<?= $tache->getId() ?>"> <?= $tache->getNom() ?> : <?= $tache->getDescription() ?></label> <label for="task-<?= $tache->getId() ?>"> <?= $tache->getNom() ?> : <?= $tache->getDescription() ?></label>
@ -209,7 +222,7 @@
</form> </form>
<a href="index.php?action=SupprimerTachePrive&idTache=<?= $tache->getId() ?>"> <a href="index.php?action=SupprimerTachePrive&idTache=<?= $tache->getId() ?>">
<button class="btn btn-default"> <button class="btn btn-default">
<img src="./vue/Images/trash2.png" width="20" /> <img src="./vue/Images/trash.png" width="20" />
</button> </button>
</a> </a>
</li> </li>
@ -240,21 +253,21 @@
<nav aria-label="Page navigation example"> <nav aria-label="Page navigation example">
<center> <center>
<p>Page n°<?php echo $_COOKIE['page'] ?></p> <p>Page n°<?php echo $_SESSION['pageUser'] ?></p>
</center> </center>
<ul class="pagination justify-content-center"> <ul class="pagination justify-content-center">
<li class="page-item"> <li class="page-item">
<a class="page-link" href="previousPage">Previous</a> <a class="page-link" href="previousPagePrive">Previous</a>
</li> </li>
<li class="page-item"> <li class="page-item">
<a class="page-link" href="nextPage">Next</a> <a class="page-link" href="nextPagePrive">Next</a>
</li> </li>
</ul> </ul>
</nav> </nav>
</body> </body>
<!-- Footer --> <!-- Footer -->
<footer class="text-center text-lg-start bg-light "> <footer class="text-center text-lg-start bg-light sticky-bottom">
<br> <br>
<!-- Section: Links --> <!-- Section: Links -->
<section class=""> <section class="">

@ -6,12 +6,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Home Page</title> <title>Home Page</title>
<!-- CSS only --> <!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https:/stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./vue/css/task.css"> <link rel="stylesheet" href="./vue/css/task.css">
<!-- JavaScript Bundle with Popper --> <!-- Latest compiled and minified CSS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!-- jQuery library -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.1/dist/jquery.slim.min.js"></script>
<!-- Popper JS -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
</head> </head>
<body style="-webkit-user-select: none; /* Safari */ <body style="-webkit-user-select: none; /* Safari */
@ -72,6 +78,19 @@
$total = 0; $total = 0;
?> ?>
<!-- Modifier couleur -->
<script>
$(document).ready(function(){
$("#selector").change(function(){
$("body").toggleClass("bg-secondary");
$("nav").toggleClass("navbar-dark bg-dark");
$(".custom-control-label").toggleClass("text-white");
});
});
</script>
<!-- Affichage des listes --> <!-- Affichage des listes -->
<div class="container py-2 h-100"> <div class="container py-2 h-100">
@ -179,7 +198,7 @@
?> ?>
<li class="list-group-item border-0 d-flex align-items-center ps-0"> <li class="list-group-item border-0 d-flex align-items-center ps-0">
<form name="action" action="index.php?action=check" method="POST"> <form name="action" action="check" method="POST">
<input class="form-check-input me-3" id="task-<?= $tache->getId() ?>" type="checkbox" onChange="submit();" <input class="form-check-input me-3" id="task-<?= $tache->getId() ?>" type="checkbox" onChange="submit();"
<?php if($tache->getEstValide() == 1) echo "checked" ?>> <?php if($tache->getEstValide() == 1) echo "checked" ?>>
<label for="task-<?= $tache->getId() ?>"> <?= $tache->getNom() ?> : <?= $tache->getDescription() ?></label> <label for="task-<?= $tache->getId() ?>"> <?= $tache->getNom() ?> : <?= $tache->getDescription() ?></label>
@ -188,7 +207,7 @@
</form> </form>
<a href="index.php?action=SupprimerTache&idTache=<?= $tache->getId() ?>"> <a href="index.php?action=SupprimerTache&idTache=<?= $tache->getId() ?>">
<button class="btn btn-default"> <button class="btn btn-default">
<img src="./vue/Images/trash2.png" width="20" /> <img src="./vue/Images/trash.png" width="20" />
</button> </button>
</a> </a>
</li> </li>
@ -216,9 +235,9 @@
} }
?> ?>
<nav aria-label="Page navigation example"> <div aria-label="Page navigation example" class="NavPage">
<center> <center>
<p>Page n°<?php echo $_COOKIE['page'] ?></p> <p>Page n°<?php echo $_SESSION['page'] ?></p>
</center> </center>
<ul class="pagination justify-content-center "> <ul class="pagination justify-content-center ">
<li class="page-item"> <li class="page-item">
@ -228,11 +247,11 @@
<a class="page-link" href="nextPage">Next</a> <a class="page-link" href="nextPage">Next</a>
</li> </li>
</ul> </ul>
</nav> </div>
</body> </body>
<!-- Footer --> <!-- Footer -->
<footer class="text-center text-lg-start bg-light "> <footer class="text-center text-lg-start bg-light sticky-bottom">
<br> <br>
<!-- Section: Links --> <!-- Section: Links -->
<section class=""> <section class="">

@ -15,7 +15,6 @@
</head> </head>
<body> <body>
<div class="model"> <div class="model">
<h1>Un problème est survenue !</h1> <h1>Un problème est survenue !</h1>
<?php <?php
@ -27,6 +26,5 @@
?> ?>
<a href="VueListePublic">Revenir</a> <a href="VueListePublic">Revenir</a>
</div> </div>
</body> </body>
</html> </html>

Loading…
Cancel
Save