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

@ -20,7 +20,6 @@ class VisitorCtrl
else
$action = null;
//if(isset($_POST['listId'])) var_dump($_POST['listId']);
switch($action){
case null:
$this->loadHome();
@ -77,6 +76,10 @@ class VisitorCtrl
# supprimer une tache
break;
case 'isDone':
$this->isDone();
break;
default:
#
$TMessage[] = 'Unexpected error';
@ -150,5 +153,9 @@ class VisitorCtrl
$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="action" value="pageTache"></input>
</div>
</form method="post" action="index.php">
</form>
<table class="table mb-4">
<thead>
<tr>
@ -81,13 +81,31 @@
# 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>
<td>'.$t->get_priorite().'</td>';
} else {
echo '
<tr>
<td><del>'.$t->get_titre().'</del></td>
<td><del>'.$t->get_priorite().'</del></td>';
}
echo '
<td>
<button type="submit" class="btn btn-success ms-1">&#10004;</button>
<button type="submit" class="btn btn-danger">&#10006;</button>
<form action="index.php" method="post" class="d-inline-block">
<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>
</tr>';
}

Loading…
Cancel
Save