1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
if($number_of_rows > 0)
{
$count = 0;
foreach($result as $row)
{
$date = DateTimeImmutable::createFromFormat('d/m/Y', $row['etat2']);
$today = new DateTimeImmutable();
$color = 'red';
if ($date < $today) {
if ($date >= $today->modify('-3 years')) {
$color = 'orange';
} elseif ($date >= $today->modify('-5 years')) {
$color = 'red';
}
}
if ($date > $today) {
if ($date <= $today->modify('+3 years')) {
$color = 'orange';
} elseif ($date <= $today->modify('+5 years,+6 years,+7 years,+8 years,+9 years,+10 years,+11 years,+12 years,+13 years,+14 years,+15 years,+16 years,+17 years,+18 years,+19 years,+20 years,+21 years,+22 years,+23 years')) {
$color = 'black';
}
} |
Partager