Skip to content

Commit

Permalink
Merge pull request #49 from Ginkishi/vueListingIntervention
Browse files Browse the repository at this point in the history
Correction de bug dans les controleurs
  • Loading branch information
ginkishi authored Feb 23, 2020
2 parents a148f3a + b0db51b commit d333aa9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 40 deletions.
12 changes: 12 additions & 0 deletions app/controllers/loginC.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require_once(MODELS . DS . "loginM.php");
require_once("./controllers/homeC.php");
require_once("./controllers/sessionHandler.php");
require_once(MODELS . DS . "InterventionM.php");

class LoginController
{
Expand All @@ -19,6 +20,12 @@ public function index()
// Si deja connecter -> redirection vers la home page
$v = new View();
if (GestionnaireSession::is_set()) {

$InterventionModel = new InterventionM();
$interventions = $InterventionModel->getAll();
$numberOfIntervention = $InterventionModel->getNumberOfInterventionType();
$v->ajouterVariable("interventions", $interventions);
$v->ajouterVariable("numberOfIntervention", $numberOfIntervention);
$v->ajouterLink("personal", "home");
$v->afficher("home_index");
} else {
Expand Down Expand Up @@ -50,6 +57,11 @@ public function authenticate()
$_SESSION["grade"] = $record[0]['P_GRADE'];*/
// var_dump($record);
$v = new View();
$InterventionModel = new InterventionM();
$interventions = $InterventionModel->getAll();
$numberOfIntervention = $InterventionModel->getNumberOfInterventionType();
$v->ajouterVariable("interventions", $interventions);
$v->ajouterVariable("numberOfIntervention", $numberOfIntervention);
$v->ajouterLink("personal", "home");
$v->afficher("home_index");
} else {
Expand Down
40 changes: 0 additions & 40 deletions app/views/home_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,45 +40,5 @@
<div class="number"><?= $numberOfIntervention[3]["nbIntervention"] ?> </div>
<div class="see-more"><a href="<?= LOCAL_DIR ?>intervention/listAll">Voir plus</a></div>
</div>
<div class="public-intervention">
<div class="intervention-title">Les 10 Dernières interventions</div>
<?php if ($interventions != null) { ?>
<div class="table-responsive">
<table class="table text-center table-bordered">
<thead>
<tr class="bg-dark">
<th scope="col">Numéro</th>
<th scope="col">Date de déclenchement</th>
<th scope="col">Date de fin</th>
<th scope="col">Adresse</th>
<th scope="col">Commune</th>
<th scope="col">Type d'intervention</th>
<th scope="col">Statut</th>
<th scope="col"><i class="fas fa-eye"></i></th>
<th scope="col"><i class="fas fa-edit"></i></th>
</tr>
</thead>
<tbody>
<?php foreach ($interventions as $i) : ?>
<tr>
<td><?= $i["NIntervention"]; ?></td>
<td><?= $i["datedec"]; ?></td>
<td><?= $i["datefin"]; ?></td>
<td><?= $i["Adresse"]; ?></td>
<td><?= $i["Commune"]; ?></td>
<td><?= $i["TypeIntervention"]; ?></td>
<td><?= utf8_encode($i["statut"]); ?></td>
<td><a href="<?= LOCAL_DIR ?>intervention/view/<?= $i["IDIntervention"]; ?>" class="btn btn-info btn-lg">Voir</a></td>
<td><a href="<?= LOCAL_DIR ?>intervention/modification/<?= $i["IDIntervention"]; ?>" class="btn btn-primary btn-lg">Editer</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php } else { ?>
<div class="error_msg">Aucune intervention trouvée</div>
<?php } ?>
<div class="see-more"><a href="<?= LOCAL_DIR ?>intervention/listAll">Voir plus</a></div>
</div>
</div>
</div>

0 comments on commit d333aa9

Please sign in to comment.