Ça avance plutôt bien.
mon script affiche un calendrier avec les agents sur la droite pour chaque absences on met la case d'une couleur avec l'a valeur contenu en base de donnée.
tous cela fonctionne bien sauf que si je met par exemple agent 1 en congés du 02/05 au 05/05
et agent 1 en congés maladie du 10/05/au 11/05 il va me l'afficher sur deux ligne moi je voudrais que ce soit sur la même ligne
j'ai trois tables en bdd
une 'agents'
--id
--nom
--prenom
--secteur
une 'conges'
-- id
--nom_conges
--abrev_conges
--nbre_conges
--rest
une 'absences'
--id
--id_agents
--id_conges
--date_debut
-- date_fin
mon code :
<table class="table">
<tbody>
<tr>
<td colspan=2 style="background-color:#F6E497;">
Agents
</td>
<?php foreach($datesMonth as $d): ?>
<?php $w=date('w', strtotime($d)); ?>
<?php $day=date($d);
/*echo $day;*/
?>
<td <?php
if ($day==$vic_allie OR $day==$an OR $day==$prem OR $day==$fet_nation OR $day==$assomp OR $day==$touss OR $day==$arm OR $day==$no OR $day==$paq OR $day==$asc OR $day==$pent) { echo 'style="background-color:#FE9000;"';}
else if ($w==0 OR $w==6) { echo 'style="background-color:#ccc;"';}
else {echo 'style="background-color:#efecca;"';}
?>>
<?=strftime('%a', strtotime($d));?><div><?=date('d', strtotime($d));?></div>
</td>
<?php endforeach; ?>
</tr>
<?php
// On récupère tout le contenu de la table agents
$abs = $bdd->query('SELECT * FROM agents AS ag
left JOIN absences AS abs
ON abs.id_agents = ag.id
left JOIN conges AS cg
ON abs.id_conges = cg.id
ORDER BY nom');
// On affiche chaque entrée une à une
?>
<tr>
<?php while ($donnees = $abs->fetch())
{ ?>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['nom']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['prenom']; ?></td>
<?php foreach($datesMonth as $d): ?>
<?php $w=date('w', strtotime($d));
$days=date(strtotime($d));
$day=date($d);
$date_deb = strtotime($donnees['date_debut']);
$date_fin = strtotime($donnees['date_fin']);
?>
<td <?php
if ($date_deb<=$days && $days <=$date_fin && $donnees['abrev_conges'] == 'CA' ) { echo 'style="background-color:#ff2000;"><div>'.$donnees['abrev_conges'].'</div></td>';}
else if ($date_deb<=$days && $days <=$date_fin && $donnees['abrev_conges'] == 'CM' ) { echo 'style="background-color:#9358C6;"><div>'.$donnees['abrev_conges'].'</div></td>';}
else if ($day==$vic_allie OR $day==$an OR $day==$prem OR $day==$fet_nation OR $day==$assomp OR $day==$touss OR $day==$arm OR $day==$no OR $day==$paq OR $day==$asc OR $day==$pent){ echo 'style="background-color:#FE9000;"><div></div></td>';}
else if ($w==0 OR $w==6) { echo 'style="background-color:#ccc;"><div></div></td>';}
else {echo 'style="background-color:#efecca;"><div></div></td>';}?>
<?php endforeach; ?>
</tr>
<?php
}
$abs->closeCursor(); // Termine le traitement de la requête
?>
</tbody>
</table>
cela m'affiche ça :
je voudrais que les CM et CA de NOM 1 soit sur la même ligne je ne sais pas si c'est un problème dans la conception de mes tables ou dans l'affichage de la page.
si quelqu'un peut me filer un coup de main je lui en serais reconnaissant.
Merci de passer du temps à nous orienter aider et corriger.
