donecount
Anna BOUDOUL 2 years ago
parent 227cfa0942
commit d0b7bcc83d

@ -3,8 +3,8 @@
$rep=__DIR__.'/../'; $rep=__DIR__.'/../';
$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'achanger'); //$con = new Connection('mysql:host=localhost;dbname=phpproject', 'nifranco', 'achanger');
//$con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'mdpMYSQL'); $con = new Connection('mysql:host=localhost;dbname=dbanboudoul', 'anboudoul', 'mdpMYSQL');
$TMessage = array(); $TMessage = array();

@ -95,7 +95,6 @@ class VisitorCtrl
} }
function loadHome(){ function loadHome(){
$public_lists = $this->taskModel->loadPublicLists(); $public_lists = $this->taskModel->loadPublicLists();
# le if suivant est nécéssaire dans le cas ou l'action # le if suivant est nécéssaire dans le cas ou l'action
# connection a été appeller. Dans ce cas, loadHome doit # connection a été appeller. Dans ce cas, loadHome doit
# prendre en compte le user qui vient d'être ajouter a # prendre en compte le user qui vient d'être ajouter a
@ -180,7 +179,7 @@ class VisitorCtrl
function isDone(){ function isDone(){
$this->taskModel->modifTask($_POST['idT'],'isDone',true); $this->taskModel->modifTask($_POST['idT'],'isDone',true);
if($_POST['isPriv']) if(!empty($_POST['isPriv']))
header("Location:index.php?action=voirListePriv"); header("Location:index.php?action=voirListePriv");
else else
$this->loadHome(); $this->loadHome();

@ -120,6 +120,20 @@ class TaskGateway
':user'=> array($l->get_owner(),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){ public function findUserList($user){
# pas réussit a faire une jointure optimale donc # pas réussit a faire une jointure optimale donc
# decomposé en plusieurs foncitons: # decomposé en plusieurs foncitons:

@ -53,6 +53,11 @@ class TaskModel
{ {
$this->gtw->update('list',$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) public function supList($id)
{ {

Loading…
Cancel
Save