Merge branch 'visitor-controller' of https://codefirst.iut.uca.fr/git/anna.boudoul/ProjetPHP into action&exception

merge with visitor-controller
action&exception
Anna BOUDOUL 2 years ago
commit 58e6442b48

@ -14,7 +14,7 @@
# if id = 0, on veut donc creer une nouvelle tache # if id = 0, on veut donc creer une nouvelle tache
# qui n'est pas encore dans la base de donnée et donc # qui n'est pas encore dans la base de donnée et donc
# le id sera fait avec le auto increment # le id sera fait avec le auto increment
if($id=0) if($id==0)
$this->set_id((int)null); $this->set_id((int)null);
else else
$this->set_id($id); $this->set_id($id);
@ -24,6 +24,7 @@
$this->set_dateDeb($dateDeb); $this->set_dateDeb($dateDeb);
$this->set_dateFin($dateFin); $this->set_dateFin($dateFin);
$this->set_idlist($idl); $this->set_idlist($idl);
$this->set_isDone($isDone);
} }
function get_id() { function get_id() {

@ -20,7 +20,6 @@ class VisitorCtrl
else else
$action = null; $action = null;
//if(isset($_POST['listId'])) var_dump($_POST['listId']);
switch($action){ switch($action){
case null: case null:
$this->loadHome(); $this->loadHome();
@ -77,6 +76,10 @@ class VisitorCtrl
# supprimer une tache # supprimer une tache
break; break;
case 'isDone':
$this->isDone();
break;
default: default:
# #
$TMessage[] = 'Unexpected error'; $TMessage[] = 'Unexpected error';
@ -149,6 +152,10 @@ class VisitorCtrl
$this->taskModel->supTask($_POST['idT']); $this->taskModel->supTask($_POST['idT']);
$this->loadHome(); $this->loadHome();
} }
function isDone(){
$this->taskModel->modifTask($_POST['idT'],'isDone',true);
$this->loadHome();
}
} }
?> ?>

@ -68,7 +68,7 @@
<input type="hidden" name="listId" value="'.$l->get_id().'"></input> <input type="hidden" name="listId" value="'.$l->get_id().'"></input>
<input type="hidden" name="action" value="pageTache"></input> <input type="hidden" name="action" value="pageTache"></input>
</div> </div>
</form method="post" action="index.php"> </form>
<table class="table mb-4"> <table class="table mb-4">
<thead> <thead>
<tr> <tr>
@ -81,13 +81,31 @@
# IF NO TASKS, display NO TASKS # IF NO TASKS, display NO TASKS
if(!empty($l->get_taches())){ if(!empty($l->get_taches())){
foreach($l->get_taches() as $t){ 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 ' echo '
<tr>
<td>'.$t->get_titre().'</td>
<td>'.$t->get_priorite().'</td>
<td> <td>
<button type="submit" class="btn btn-success ms-1">&#10004;</button> <form action="index.php" method="post" class="d-inline-block">
<button type="submit" class="btn btn-danger">&#10006;</button> <button type="submit" class="btn btn-success ms-1">&#10004;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="action" value="isDone">
</button>
</form>
<form action="index.php" method="post" class="d-inline-block">
<button type="submit" class="btn btn-danger">&#10006;
<input type="hidden" name="idT" value="'.$t->get_id().'"></input>
<input type="hidden" name="action" value="supprimerTache">
</button>
</form>
</td> </td>
</tr>'; </tr>';
} }

Loading…
Cancel
Save