par
team94 » 16 févr. 2017, 09:18
Bonjour à vous j'ai du laisser ce code de coté et la je me replonge dedans en y arrivant toujours pas
si quelqu'un a un peu de temps a m'accorder je lui en serais grès
alorsj'ai modifié mon code maintenant il m'affiche bien une seule ligne mais toujours un seul type d'absence je devient fou je reposte mon code et une copie d'ecran
le code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
<?php ini_set('display_errors',1);
require('inc/cal.php');
require('bdd/bdd.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Calendrier</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="img/favicon.png" />
<!-- Le styles -->
<link rel="stylesheet" href="css/style.css" />
<style type="text/css">
body { padding-top: 60px; padding-bottom: 40px; }
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</div>
</div>
</div>
<div class="container">
<table>
<?php
// tableau du haut -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// On récupère tout le contenu de la table agents
$abs = $bdd->query('SELECT * FROM absences AS abs
RIGHT JOIN agents AS ag
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
while ($donnees = $abs->fetch())
{
?>
<tr>
<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>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['date_debut']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['date_fin']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['nom_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['nbre_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['abrev_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['rest']; ?></td>
</tr>
<?php
}
$abs->closeCursor(); // Termine le traitement de la requête
?>
</table>
<!-- fin du tableau du haut ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-- affichage mois année et bouton ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<div class="row">
<div style="text-align:center; margin:0 auto 20px;">
<h4 class="year"><?=ucfirst(utf8_encode(strftime('%B', strtotime($firstDay)))) .' '.$currentYear;?></h4>
<a href="index.php?month=<?=$prevYear;?>" class="btn btn-style"><< <?=date('Y', strtotime($prevYear));?></a>
<a href="index.php?month=<?=utf8_encode($prevMonth);?>" class="btn btn-style2"><< <?=ucfirst(utf8_encode(strftime('%B', strtotime($prevMonth))));?></a>
<a href="index.php?month=<?=utf8_encode($nextMonth);?>" class="btn btn-style2"><?=ucfirst(utf8_encode(strftime('%B', strtotime($nextMonth))));?> >></a>
<a href="index.php?month=<?=$nextYear;?>" class="btn btn-style"><?=date('Y', strtotime($nextYear));?> >></a>
</div>
<!-- FIN affichage mois année et bouton ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<table class="table">
<tbody>
<!-- Premiere ligne du tableau---------------------------------------------------------------------------------------------------------------------------->
<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>
<!-- Fin Premiere ligne du tableau---------------------------------------------------------------------------------------------------------------------------->
<?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
?>
<!-- reste du tableau---------------------------------------------------------------------------------------------------------------------------->
<tr>
<?php
$nom1="";
while ($donnees = $abs->fetch()){
while($nom1 != $donnees['nom']){
echo ('
<td style="width:100px; vertical-align:middle; background-color:#F6E497;">'.$donnees['nom'].'</td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;">'.$donnees['prenom'].'</td>
');
foreach($datesMonth as $d):
$w=date('w', strtotime($d));
$days=date(strtotime($d));
$day=date($d);
$date_deb = strtotime($donnees['date_debut']);
$date_fin = strtotime($donnees['date_fin']);
echo (' <td ');
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>';}
$nom1 = $donnees['nom'];
endforeach;
}
?>
</tr>
<?php
} // fin du While
$abs->closeCursor(); // Termine le traitement de la requête
?>
</tbody>
</table>
<!-- fin du reste du tableau---------------------------------------------------------------------------------------------------------------------------->
</div>
</div> <!-- /container -->
</body>
</html>
</body>
</html>
et la copie d'ecran
[img]
http://www.atikhan.fr/Sanstitre.jpg
[/img]
Bonjour à vous j'ai du laisser ce code de coté et la je me replonge dedans en y arrivant toujours pas
si quelqu'un a un peu de temps a m'accorder je lui en serais grès
alorsj'ai modifié mon code maintenant il m'affiche bien une seule ligne mais toujours un seul type d'absence je devient fou je reposte mon code et une copie d'ecran
le code :
[php]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
<?php ini_set('display_errors',1);
require('inc/cal.php');
require('bdd/bdd.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Calendrier</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="img/favicon.png" />
<!-- Le styles -->
<link rel="stylesheet" href="css/style.css" />
<style type="text/css">
body { padding-top: 60px; padding-bottom: 40px; }
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</div>
</div>
</div>
<div class="container">
<table>
<?php
// tableau du haut -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// On récupère tout le contenu de la table agents
$abs = $bdd->query('SELECT * FROM absences AS abs
RIGHT JOIN agents AS ag
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
while ($donnees = $abs->fetch())
{
?>
<tr>
<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>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['date_debut']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['date_fin']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['nom_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['nbre_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['abrev_conges']; ?></td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;"><?php echo $donnees['rest']; ?></td>
</tr>
<?php
}
$abs->closeCursor(); // Termine le traitement de la requête
?>
</table>
<!-- fin du tableau du haut ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-- affichage mois année et bouton ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<div class="row">
<div style="text-align:center; margin:0 auto 20px;">
<h4 class="year"><?=ucfirst(utf8_encode(strftime('%B', strtotime($firstDay)))) .' '.$currentYear;?></h4>
<a href="index.php?month=<?=$prevYear;?>" class="btn btn-style"><< <?=date('Y', strtotime($prevYear));?></a>
<a href="index.php?month=<?=utf8_encode($prevMonth);?>" class="btn btn-style2"><< <?=ucfirst(utf8_encode(strftime('%B', strtotime($prevMonth))));?></a>
<a href="index.php?month=<?=utf8_encode($nextMonth);?>" class="btn btn-style2"><?=ucfirst(utf8_encode(strftime('%B', strtotime($nextMonth))));?> >></a>
<a href="index.php?month=<?=$nextYear;?>" class="btn btn-style"><?=date('Y', strtotime($nextYear));?> >></a>
</div>
<!-- FIN affichage mois année et bouton ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------>
<table class="table">
<tbody>
<!-- Premiere ligne du tableau---------------------------------------------------------------------------------------------------------------------------->
<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>
<!-- Fin Premiere ligne du tableau---------------------------------------------------------------------------------------------------------------------------->
<?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
?>
<!-- reste du tableau---------------------------------------------------------------------------------------------------------------------------->
<tr>
<?php
$nom1="";
while ($donnees = $abs->fetch()){
while($nom1 != $donnees['nom']){
echo ('
<td style="width:100px; vertical-align:middle; background-color:#F6E497;">'.$donnees['nom'].'</td>
<td style="width:100px; vertical-align:middle; background-color:#F6E497;">'.$donnees['prenom'].'</td>
');
foreach($datesMonth as $d):
$w=date('w', strtotime($d));
$days=date(strtotime($d));
$day=date($d);
$date_deb = strtotime($donnees['date_debut']);
$date_fin = strtotime($donnees['date_fin']);
echo (' <td ');
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>';}
$nom1 = $donnees['nom'];
endforeach;
}
?>
</tr>
<?php
} // fin du While
$abs->closeCursor(); // Termine le traitement de la requête
?>
</tbody>
</table>
<!-- fin du reste du tableau---------------------------------------------------------------------------------------------------------------------------->
</div>
</div> <!-- /container -->
</body>
</html>
</body>
</html>[/php]
et la copie d'ecran
[img]
http://www.atikhan.fr/Sanstitre.jpg
[/img]