Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MUTENDELE_MUKEKWA_ADOLPHINE_G2_GESTION
Submodule MUTENDELE_MUKEKWA_ADOLPHINE_G2_GESTION added at 76a8c8
23 changes: 23 additions & 0 deletions attributionFonctions/__add_tache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

require_once('tache.class.php');
require_once('tache.dao.php');



if(isset($_POST['description'], $_POST['datedebut'], $_POST['datefin'], $_POST['idagent'])
and !empty($_POST['description']) and !empty($_POST['datedebut']) and !empty($_POST['datefin']) and !empty($_POST['idagent'])) {

$t = new Tache(0, $_POST['description'], $_POST['datedebut'], $_POST['datefin'], $_POST['idagent']);

$tdao = new TacheDAO();
$tdao->add($t);

header('Location: index.php');


} else {
echo 'Erreur dans les données envoyées';
}

?>
27 changes: 27 additions & 0 deletions attributionFonctions/__changer_tache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

require_once('tache.class.php');
require_once('tache.dao.php');

if(isset($_POST['id'],$_POST['description'],$_POST['datedebut'],$_POST['datefin'],$_POST['idagent']) and !empty($_POST['id']) and !empty($_POST['description'])
and !empty($_POST['datedebut']) and !empty($_POST['datefin']) and !empty($_POST['idagent']))
{
$t = new Tache($_POST['id'],$_POST['description'],$_POST['datedebut'],$_POST['datefin'],$_POST['idagent']);
$tdao = new TacheDAO();
$lt = $tdao->getAllTache();

$find = false;
foreach($lt as $te) {
if($te->getDescription() == $t->getDescription()){
$find = true;
break;
}
}
if(!$find) {
$tdao->Modifier($t);
}

header('Location: taches.php');
}

?>
27 changes: 27 additions & 0 deletions attributionFonctions/__modifier_fonction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

<?php

require_once('fonction.class.php');
require_once('fonction.dao.php');

if(isset($_POST['id'],$_POST['intitule'],$_POST['description']) and !empty($_POST['id'])and !empty($_POST['intitule']) and !empty($_POST['description']))
{
$f = new Fonction($_POST['id'], $_POST['intitule'], $_POST['description']);
$fdao = new FonctionDAO();
$lf = $fdao->getAllFonction();

$find = false;
foreach($lf as $fe) {
if($fe->getIntitule() == $f->getIntitule()){
$find = true;
break;
}
}
if(!$find) {
$fdao->Modifier($f);
}

header('Location: fonctions.php');
}

?>
56 changes: 56 additions & 0 deletions attributionFonctions/changer_tache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!doctype>
<html>
<head>
<title>Attribution des fonctions</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<?php include_once('head.php'); ?>

<div>
<form method="post" action="__changer_tache.php">

<?php
if(isset($_GET['id']) and !empty($_GET['id'])) {
echo '<input type="hidden" name="id" value="'.$_GET['id'].'">';
} else {
header('Location: tache.php');
}
?>
<label for="description">Description :</label>
<input type="text" name="description" id="description" /><br />
<label for="datedebut">Date début :</label>
<input type="date" name="datedebut" id="datedebut" /><br />
<label for="datefin">Date fin :</label>
<input type="date" name="datefin" id="datefin" /><br />
<label for="idagent">Agent :</label>
<select name="idagent" id="idagent">

<?php
require_once('agent.class.php');
require_once('agent.dao.php');

$adao = new AgentDAO();
$la = $adao->getAllAgent();

foreach($la as $a) {
echo '
<option value="'.$a->getId().'">'.$a->getNom().'</option>
';
}

?>

</select><br />
<input type="submit" value="Enregistrer" />



</form>
</div>

<?php include_once('foot.php'); ?>
</body>
</html>

18 changes: 18 additions & 0 deletions attributionFonctions/del_tache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

require_once('tache.class.php');
require_once('tache.dao.php');

if(isset($_GET['id']) and !empty($_GET['id'])) {

$fdao = new TacheDAO();
$fdao->supp($_GET['id']);

header('Location: taches.php');


} else {
echo 'Erreur quelque part';
}

?>
16 changes: 14 additions & 2 deletions attributionFonctions/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
require_once('fonction.dao.php');
require_once('agent.class.php');
require_once('agent.dao.php');
require_once('tache.class.php');
require_once('tache.dao.php');

$fdao = new FonctionDAO();
$lf = $fdao->getAllFonction();
$adao = new AgentDAO();
$la = $adao->getAllAgent();

$tdao = new TacheDAO();
$lt = $tdao->getAllTache();

echo '<table>';
echo '
<tr>
Expand All @@ -72,6 +76,14 @@
';
$compteur = 1;
foreach($la as $a) {
$conte=0;
foreach ($lt as $t) {
# code...
if($t->getIdagent()==$a->getId()){
$conte ++;
}

}
echo '<tr>
<td>'.$compteur.'</td>
<td>'.$a->getNom().'</td>
Expand All @@ -88,7 +100,7 @@
break;
}
}
echo '<td></td>';
echo '<td>'.$conte.'</td>';
echo '<td><a href="changer_fonction.php?id='.$a->getId().'&nom='.$a->getNom().'"><img src="change.jpg" alt="change" width="30px;" /></a></td>';
echo '</tr>';
$compteur++;
Expand Down
31 changes: 31 additions & 0 deletions attributionFonctions/tache.dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,37 @@ function __construct() {
$this->bdd = Connexion::getConnexion();
}

function add(Tache $t) {
$req = $this->bdd->prepare('INSERT INTO tache(description,datedebut,datefin,idagent)
VALUES(:description,:datedebut,:datefin,:idagent)');
$req->execute(array(
'description' => $t->getDescription(),
'datedebut' => $t->getDatedebut(),
'datefin' => $t->getDatefin(),
'idagent' => $t->getIdagent()
));
}

function modifier(Tache $t) {
$req = $this->bdd->prepare('UPDATE tache SET description = :description,datedebut= :datedebut, datefin= :datefin, idagent= :idagent WHERE id = :id');
$req->execute(array(
'description' => $t->getDescription(),
'datedebut'=> $t->getDatedebut(),
'datefin' => $t->getDatefin(),
'idagent'=> $t->getIdagent(),
'id' => $t->getId()
));
}


function supp($idtache) {
$req = $this->bdd->prepare('DELETE FROM tache WHERE id = :id');
$req->execute(array(
'id' => $idtache
));
}


function getAllTache() {
$req = $this->bdd->query('SELECT * FROM tache');
$tabTache = array();
Expand Down
File renamed without changes.