diff --git a/controller/CtrlUser.php b/controller/CtrlUser.php deleted file mode 100644 index b5b97c0..0000000 --- a/controller/CtrlUser.php +++ /dev/null @@ -1,38 +0,0 @@ -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); - } - } - -?> \ No newline at end of file diff --git a/controller/FrontCtrl.php b/controller/FrontCtrl.php index adfeaa9..b826d11 100644 --- a/controller/FrontCtrl.php +++ b/controller/FrontCtrl.php @@ -9,7 +9,7 @@ class FrontController function __construct(){ session_start(); try{ - $user = $this->usrMdl.isUser(); // cette fonction retourne quoi? + $user = $this->usrMdl->isUser(); // cette fonction retourne quoi? $action = $_REQUEST['action']; if(($i = array_search($action,$action_User)) !== false){ # si action dans la liste d'actions user diff --git a/controller/UserCtrl.php b/controller/UserCtrl.php index 1790a59..3c96233 100644 --- a/controller/UserCtrl.php +++ b/controller/UserCtrl.php @@ -12,25 +12,27 @@ class UserCtrl $action=$_REQUEST['action']; switch($action){ - // voir les listes privees - case 'voir_liste_priv': - $this->loadListePriv(); - break; + // // voir les listes privees + // case 'voir_liste_priv': + // $this->loadListePriv(); + // break; - // ajouter une liste privee - case 'creer_liste_priv': - $this->newListPrivate(); - break; + // // ajouter une liste privee + // case 'creer_liste_priv': + // $this->newListPrivate(); + // break; - } - } catch(Exception $e) { - require("../view/erreur.php"); - } + // } + // } catch(Exception $e) { + // require("../view/erreur.php"); + // } } public function loadListePriv(){ $name = "Liste privée"; - $TabList = array(); + $taskmdl = new TaskModel($this->con); + $TabTask = $taskmdl->loadPublicLists(); + var_dump($TabTask); // $TabList[] = new ListTask(0, "Projet PHP"); // $TabList[] = new ListTask(1, "Projet Blazor"); $TabListPriv = $this->taskmodel->getPrivateList(); diff --git a/dal/TaskGateway.php b/dal/TaskGateway.php index 5c7f374..a8f7e25 100644 --- a/dal/TaskGateway.php +++ b/dal/TaskGateway.php @@ -55,6 +55,7 @@ class TaskGateway # 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) { @@ -71,10 +72,10 @@ class TaskGateway $results=$this->con->getResults(); foreach($results as $row) { - $tabTaches[]=new Task($row['id'],$row['titre'],$row['description'],$row['priorite'], + $tabResult[]=new Task($row['id'],$row['titre'],$row['description'],$row['priorite'], $row['idList'],$row['dateDebut'],$row['dateFin'],$row['isDone']); } - return $tabTaches; + return $tabResult; } else if($table == 'list'){ if(strcmp($element,"")==0) @@ -92,12 +93,15 @@ class TaskGateway $results=$this->con->getResults(); foreach($results as $row) { - $tabList[]=new ListTask($row['id'],$row['nom'],$row['user'],$row['dc']); + $tabResult[]=new ListTask($row['id'],$row['nom'],$row['user'],$row['dc']); } - return $tabList; + 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){ diff --git a/index.php b/index.php index 5fe3c7f..efbdd90 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ $fc = new FrontCtrl(); $TMessage = array(); - require_once(controller/FrontCtrl.php); - require(erreur.php); + require_once("controller/FrontCtrl.php"); + require("erreur.php"); ?> diff --git a/tests/credentials.php b/tests/credentials.php index 9d5efdf..e7d7377 100644 --- a/tests/credentials.php +++ b/tests/credentials.php @@ -1,4 +1,4 @@ diff --git a/tests/test.php b/tests/test.php index 48b3e02..22e10c0 100644 --- a/tests/test.php +++ b/tests/test.php @@ -14,8 +14,9 @@ include("credentials.php"); $con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'achanger'); # gateway +// $t = new Task(3,'richarlison voltar pro flu','desc.','urgent','0'); // $tgt = new TaskGateway($con); -//$tgt->insert($t); +// $tgt->insertT($t); //$tgt->delete('10'); //$taches = $tgt->findUserList('nifranco'); // foreach($taches as $t){ @@ -47,6 +48,13 @@ foreach($tasks as $i) // echo $t->get_id()."
"; // } // } +// //$tasks = $mt->getTaskBy('titre','tache1'); +// $tasks = $mt->getAllTask(); +// foreach($tasks as $i) +// echo $i->get_id()."
"; +// $tasks = $mt->loadPublicLists(); +// foreach($tasks as $i) +// echo $i->get_id()."
"; // $mt->addList('002','todo2','nifranco'); // $mt->modifList('2','nom','22do'); @@ -75,7 +83,12 @@ require('../controller/UserCtrl.php'); // $mdl->ajouter('Anna', 'unmdptrescomplique'); // $mdl->modifLogin('Anna', 'Aeryn'); // $mdl->modifMdp('Aeryn', 'wtfmec'); -// $mdl->supprimer('Aeryn'); +// $mdl->supprimer('Aeryn'); +// $mdl->connexion('Aeryn', 'wtfmec'); + +$usrctrl = new UserCtrl($con); +// $usrctrl->loadListePriv(); +$usrctrl->loadListePriv(); ?> diff --git a/view/ajouter b/view/ajouter deleted file mode 100644 index e69de29..0000000 diff --git a/view/liste.php b/view/liste.php index d11235d..0cf1a4c 100644 --- a/view/liste.php +++ b/view/liste.php @@ -1,14 +1,19 @@ - + + + - '; - echo '

'.$name.'

'; - echo '
'; - foreach($TabList as $liste){ - echo ''; - } - echo '
'; -?> \ No newline at end of file + rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" + crossorigin="anonymous"> + + + '.$name.'
'; + echo '
'; + foreach($TabList as $liste){ + echo ''; + } + echo '
'; + ?> + + diff --git a/view/newList.html b/view/newList.php similarity index 100% rename from view/newList.html rename to view/newList.php diff --git a/view/list.html b/view/task.php similarity index 60% rename from view/list.html rename to view/task.php index 7563734..dc58cc5 100644 --- a/view/list.html +++ b/view/task.php @@ -23,40 +23,28 @@ - - - - - - - - - - - - - - - - - - - - - - - -
TaskImportanceActions
Faire le controlleurUrgent - - -
Finir les vuesMoyen - - -
Gestion des erreursImportant - - - -
+ + + Task + Importance + Actions + + + + + '.$task->get_titre().' + '.$task->get_priorite().' + + + + + '; + } + ?> + +