File "planning.php"
Full Path: /home/analogde/www/Design/Dev tableau/planning.php
File size: 2.1 KB
MIME-type: text/x-php
Charset: utf-8
<?php
// Données simulées sans base de données
$taches = [
["nom_tache" => "Finaliser le rapport", "date_initiale" => "2024-01-10", "date_reelle" => "2024-01-12"],
["nom_tache" => "Réunion client", "date_initiale" => "2024-02-05", "date_reelle" => "2024-02-05"],
["nom_tache" => "Déploiement de l'application", "date_initiale" => "2024-03-01", "date_reelle" => "2024-03-10"],
["nom_tache" => "Mise à jour serveur", "date_initiale" => "2024-04-15", "date_reelle" => "2024-04-14"],
["nom_tache" => "Correction des bugs", "date_initiale" => "2024-05-20", "date_reelle" => "2024-05-25"]
];
?>
<!DOCTYPE html>
<html>
<head>
<title>Suivi des Retards</title>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid black; padding: 8px; text-align: left; }
.retard { background-color: red; color: white; }
</style>
</head>
<body>
<h2>Suivi des Retards des Tâches</h2>
<table>
<tr>
<th>Nom de la Tâche</th>
<th>Date Planifiée</th>
<th>Date Réelle</th>
<th>Retard (jours)</th>
</tr>
<?php foreach ($taches as $tache): ?>
<?php
// Conversion des dates en objets DateTime
$date_initiale = new DateTime($tache['date_initiale']);
$date_reelle = new DateTime($tache['date_reelle']);
// Calcul du retard en jours
$retard = $date_initiale->diff($date_reelle)->days;
// Vérification si la tâche est en retard
$en_retard = $date_reelle > $date_initiale;
?>
<tr class="<?php echo $en_retard ? 'retard' : ''; ?>">
<td><?php echo htmlspecialchars($tache['nom_tache']); ?></td>
<td><?php echo htmlspecialchars($tache['date_initiale']); ?></td>
<td><?php echo htmlspecialchars($tache['date_reelle']); ?></td>
<td><?php echo $en_retard ? $retard : '0'; ?></td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>