par
Allatric » 30 mai 2013, 19:17
Voila mon problème pour le moment j'en suis la:
Donc en gros ça fait sur chaque ligne une date et ensuite chaque colonne d'heure représente une heure et chaque colonne heure change de couleur suivant le début de l'horaire et la fin ensuite j'affiche l'heure début et fin pour gagner en lisibilité.
Tout marche, mais je ne sais pas comment tenir compte des minutes.
Dans cette exemple, je ne fais que les afficher.
Mon problème:
Comment faire en sorte d'afficher les minutes ? car j'aimerais que ça soit dynamique, car le but c'est de faire une sorte de graphique pour voir visuellement quand on a commencé le plus tôt dans la journée... et sans les minutes ça fausse tout...
Je pensais ajouter une colonne par minute différente, donc en gros par exemple une heure de fin est 10h15, 11h25... ça rajoutera plusieurs colonne minutes, mais il faut pas nom plus rajouter des colonnes doubles et surtout l'afficher au bon endroit et je ne sais pas comment gérer l'ajout de colonne au tableau.
Surtout que j'ai un autre problème: si j'ai des horaire: genre 15h>22h, pas de problème, mais admeton que j'ai un 22h>4h, ça ne s'affiche pas.
Donc je ne sais pas trop comment faire.
Mon code:
<table class="box" style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr style="font-size: 13px;">
<th style="text-align: center;">Date</th>
<th nowrap="nowrap">00h00</th>
<th nowrap="nowrap">01h00</th>
<th nowrap="nowrap">02h00</th>
<th nowrap="nowrap">03h00</th>
<th nowrap="nowrap">04h00</th>
<th nowrap="nowrap">05h00</th>
<th nowrap="nowrap">06h00</th>
<th nowrap="nowrap">07h00</th>
<th nowrap="nowrap">08h00</th>
<th nowrap="nowrap">09h00</th>
<th nowrap="nowrap">10h00</th>
<th nowrap="nowrap">11h00</th>
<th nowrap="nowrap">12h00</th>
<th nowrap="nowrap">13h00</th>
<th nowrap="nowrap">14h00</th>
<th nowrap="nowrap">15h00</th>
<th nowrap="nowrap">16h00</th>
<th nowrap="nowrap">17h00</th>
<th nowrap="nowrap">18h00</th>
<th nowrap="nowrap">19h00</th>
<th nowrap="nowrap">20h00</th>
<th nowrap="nowrap">21h00</th>
<th nowrap="nowrap">22h00</th>
<th nowrap="nowrap">23h00</th>
</tr>
<?php
$i2 =1;
$reponses = $bdd->query('SELECT
DATE_FORMAT(horaire_debut, "%Y-%m-%d %H:%i") AS date,
DATE_FORMAT(horaire_debut, "%Y-%m-%d %H:%i:%s") AS horaire_debut,
DATE_FORMAT(horaire_fin, "%Y-%m-%d %H:%i:%s") AS horaire_fin,
DATE_FORMAT(horaire_debut, "%H") AS horaire_debut_heures,
DATE_FORMAT(horaire_debut, "%i") AS horaire_debut_minutes,
DATE_FORMAT(horaire_fin, "%H") AS horaire_fin_heures,
DATE_FORMAT(horaire_fin, "%i") AS horaire_fin_minutes,
repos
FROM travail
Order By horaire_debut ASC');
// WHERE WEEK( `horaire_debut` , 1 ) ='.date('W').'
while ($donnees = $reponses->fetch())
{
$date = $donnees['date'];
$horaire_debut = $donnees['horaire_debut'];
$horaire_fin = $donnees['horaire_fin'];
$repos = $donnees['repos'];
$horaire_debut_heure = $donnees['horaire_debut_heures'];
$horaire_debut_minutes = $donnees['horaire_debut_minutes'];
$horaire_fin_heures = $donnees['horaire_fin_heures'];
$horaire_fin_minutes = $donnees['horaire_fin_minutes'];
/*------*/
$d1 = new DateTime($horaire_debut);
$d2 = new DateTime($horaire_fin);
$diff = $d1->diff($d2);
$diffa = $d1->diff($d2);
$diffm = $d1->diff($d2);
$diffh = $d1->diff($d2);
$diffi= $d1->diff($d2);
$diffs = $d1->diff($d2);
$nb_an = $diffa->y;
$nb_mois = $diffm->m;
$nb_jours = $diff->d;
// echo "<br>";
$nb_heure = $diffh->h;
$nb_min = $diffi->i;
$nb_sec = $diffs->s;
if($repos == 0)
{
$heure_travaille = ' - '.$nb_heure.'heures et'.$nb_min.'minutes';
}
else
{
$heure_travaille = ' - Repos';
}
/*------*/
$horaire_debut_heure = str_replace(array('01'), '1', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('02'), '2', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('03'), '3', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('04'), '4', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('05'), '5', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('06'), '6', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('07'), '7', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('08'), '8', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('09'), '9', $horaire_debut_heure);
$horaire_fin_heures = str_replace(array('01'), '1', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('02'), '2', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('03'), '3', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('04'), '4', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('05'), '5', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('06'), '6', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('07'), '7', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('08'), '8', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('09'), '9', $horaire_fin_heures);
if(!empty($repos))
{
$colspan = 'colspan="24"';
$degrader = '';
}
else
{
$colspan = '';
$degrader = 'background: -moz-linear-gradient(bottom, #CCCCCC, #F1F1F1);';
}
?>
<tr style="font-size: 13px;background-color: <?php echo ( ($i2++ % 2 == 0) ? '#C0C0C0': '#999999' ); ?>">
<td>
<?php
echo ' <infobulle_css3><a class="infobulle_css3">'.DateComplete_2($date).'<span>'.DateComplete_2($date).$heure_travaille.'</span></a></infobulle_css3>'
?>
</td>
<?php
for ($i = 0; $i <= 23; $i++) {
if( ($horaire_debut_heure <= $i) AND ($horaire_fin_heures >= $i))
{
?>
<td <?php echo $colspan; ?> style="text-align: center;<?php echo $degrader; ?>">
<?PHP
if($i == $horaire_debut_heure)
{
if(!empty($repos))
{
echo '- <infobulle_css3><a class="infobulle_css3">Repos<span>Jour de Repos</span></a></infobulle_css3> -';
}
elseif(!empty($horaire_debut_heure) AND !empty($horaire_debut_minutes))
{
if( ($horaire_debut_heure >= 1) AND ($horaire_debut_heure <= 9))
{
$zero_debut_heure = 0;
}
else
{
$zero_debut_heure = '';
}
echo '<infobulle_css3><a class="infobulle_css3">'.$zero_debut_heure.$horaire_debut_heure.'h'.$horaire_debut_minutes.'<span>Horaire début: '.$zero_debut_heure.$horaire_debut_heure.'h'.$horaire_debut_minutes.'</span></a></infobulle_css3>';
}
else
{
}
}
elseif($i == $horaire_fin_heures)
{
if( ($horaire_fin_heures >= 1) AND ($horaire_fin_heures <= 9))
{
$zero_fin_heure = 0;
}
else
{
$zero_fin_heure = '';
}
echo '<infobulle_css3><a class="infobulle_css3">'.$zero_fin_heure.$horaire_fin_heures.'h'.$horaire_fin_minutes.'<span>Horaire fin: '.$zero_fin_heure.$horaire_fin_heures.'h'.$horaire_fin_minutes.'</span></a></infobulle_css3>';
}
else
{
// echo $i.'h';
}
?>
</td>
<?php
}
else
{
if(!empty($repos))
{
}
else
{
?><td nowrap="nowrap" style=""> </td><?php
}
}
}
?>
</tr>
<?php
} $reponses->closeCursor();
?>
</tbody>
</table>
Voila mon problème pour le moment j'en suis la:
[img]http://nsm08.casimages.com/img/2013/05/30//1305300653555663611246395.jpg[/img]
Donc en gros ça fait sur chaque ligne une date et ensuite chaque colonne d'heure représente une heure et chaque colonne heure change de couleur suivant le début de l'horaire et la fin ensuite j'affiche l'heure début et fin pour gagner en lisibilité.
Tout marche, mais je ne sais pas comment tenir compte des minutes.
Dans cette exemple, je ne fais que les afficher.
Mon problème:
Comment faire en sorte d'afficher les minutes ? car j'aimerais que ça soit dynamique, car le but c'est de faire une sorte de graphique pour voir visuellement quand on a commencé le plus tôt dans la journée... et sans les minutes ça fausse tout...
Je pensais ajouter une colonne par minute différente, donc en gros par exemple une heure de fin est 10h15, 11h25... ça rajoutera plusieurs colonne minutes, mais il faut pas nom plus rajouter des colonnes doubles et surtout l'afficher au bon endroit et je ne sais pas comment gérer l'ajout de colonne au tableau.
Surtout que j'ai un autre problème: si j'ai des horaire: genre 15h>22h, pas de problème, mais admeton que j'ai un 22h>4h, ça ne s'affiche pas.
Donc je ne sais pas trop comment faire.
Mon code:
[php]<table class="box" style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr style="font-size: 13px;">
<th style="text-align: center;">Date</th>
<th nowrap="nowrap">00h00</th>
<th nowrap="nowrap">01h00</th>
<th nowrap="nowrap">02h00</th>
<th nowrap="nowrap">03h00</th>
<th nowrap="nowrap">04h00</th>
<th nowrap="nowrap">05h00</th>
<th nowrap="nowrap">06h00</th>
<th nowrap="nowrap">07h00</th>
<th nowrap="nowrap">08h00</th>
<th nowrap="nowrap">09h00</th>
<th nowrap="nowrap">10h00</th>
<th nowrap="nowrap">11h00</th>
<th nowrap="nowrap">12h00</th>
<th nowrap="nowrap">13h00</th>
<th nowrap="nowrap">14h00</th>
<th nowrap="nowrap">15h00</th>
<th nowrap="nowrap">16h00</th>
<th nowrap="nowrap">17h00</th>
<th nowrap="nowrap">18h00</th>
<th nowrap="nowrap">19h00</th>
<th nowrap="nowrap">20h00</th>
<th nowrap="nowrap">21h00</th>
<th nowrap="nowrap">22h00</th>
<th nowrap="nowrap">23h00</th>
</tr>
<?php
$i2 =1;
$reponses = $bdd->query('SELECT
DATE_FORMAT(horaire_debut, "%Y-%m-%d %H:%i") AS date,
DATE_FORMAT(horaire_debut, "%Y-%m-%d %H:%i:%s") AS horaire_debut,
DATE_FORMAT(horaire_fin, "%Y-%m-%d %H:%i:%s") AS horaire_fin,
DATE_FORMAT(horaire_debut, "%H") AS horaire_debut_heures,
DATE_FORMAT(horaire_debut, "%i") AS horaire_debut_minutes,
DATE_FORMAT(horaire_fin, "%H") AS horaire_fin_heures,
DATE_FORMAT(horaire_fin, "%i") AS horaire_fin_minutes,
repos
FROM travail
Order By horaire_debut ASC');
// WHERE WEEK( `horaire_debut` , 1 ) ='.date('W').'
while ($donnees = $reponses->fetch())
{
$date = $donnees['date'];
$horaire_debut = $donnees['horaire_debut'];
$horaire_fin = $donnees['horaire_fin'];
$repos = $donnees['repos'];
$horaire_debut_heure = $donnees['horaire_debut_heures'];
$horaire_debut_minutes = $donnees['horaire_debut_minutes'];
$horaire_fin_heures = $donnees['horaire_fin_heures'];
$horaire_fin_minutes = $donnees['horaire_fin_minutes'];
/*------*/
$d1 = new DateTime($horaire_debut);
$d2 = new DateTime($horaire_fin);
$diff = $d1->diff($d2);
$diffa = $d1->diff($d2);
$diffm = $d1->diff($d2);
$diffh = $d1->diff($d2);
$diffi= $d1->diff($d2);
$diffs = $d1->diff($d2);
$nb_an = $diffa->y;
$nb_mois = $diffm->m;
$nb_jours = $diff->d;
// echo "<br>";
$nb_heure = $diffh->h;
$nb_min = $diffi->i;
$nb_sec = $diffs->s;
if($repos == 0)
{
$heure_travaille = ' - '.$nb_heure.'heures et'.$nb_min.'minutes';
}
else
{
$heure_travaille = ' - Repos';
}
/*------*/
$horaire_debut_heure = str_replace(array('01'), '1', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('02'), '2', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('03'), '3', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('04'), '4', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('05'), '5', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('06'), '6', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('07'), '7', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('08'), '8', $horaire_debut_heure);
$horaire_debut_heure = str_replace(array('09'), '9', $horaire_debut_heure);
$horaire_fin_heures = str_replace(array('01'), '1', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('02'), '2', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('03'), '3', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('04'), '4', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('05'), '5', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('06'), '6', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('07'), '7', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('08'), '8', $horaire_fin_heures);
$horaire_fin_heures = str_replace(array('09'), '9', $horaire_fin_heures);
if(!empty($repos))
{
$colspan = 'colspan="24"';
$degrader = '';
}
else
{
$colspan = '';
$degrader = 'background: -moz-linear-gradient(bottom, #CCCCCC, #F1F1F1);';
}
?>
<tr style="font-size: 13px;background-color: <?php echo ( ($i2++ % 2 == 0) ? '#C0C0C0': '#999999' ); ?>">
<td>
<?php
echo ' <infobulle_css3><a class="infobulle_css3">'.DateComplete_2($date).'<span>'.DateComplete_2($date).$heure_travaille.'</span></a></infobulle_css3>'
?>
</td>
<?php
for ($i = 0; $i <= 23; $i++) {
if( ($horaire_debut_heure <= $i) AND ($horaire_fin_heures >= $i))
{
?>
<td <?php echo $colspan; ?> style="text-align: center;<?php echo $degrader; ?>">
<?PHP
if($i == $horaire_debut_heure)
{
if(!empty($repos))
{
echo '- <infobulle_css3><a class="infobulle_css3">Repos<span>Jour de Repos</span></a></infobulle_css3> -';
}
elseif(!empty($horaire_debut_heure) AND !empty($horaire_debut_minutes))
{
if( ($horaire_debut_heure >= 1) AND ($horaire_debut_heure <= 9))
{
$zero_debut_heure = 0;
}
else
{
$zero_debut_heure = '';
}
echo '<infobulle_css3><a class="infobulle_css3">'.$zero_debut_heure.$horaire_debut_heure.'h'.$horaire_debut_minutes.'<span>Horaire début: '.$zero_debut_heure.$horaire_debut_heure.'h'.$horaire_debut_minutes.'</span></a></infobulle_css3>';
}
else
{
}
}
elseif($i == $horaire_fin_heures)
{
if( ($horaire_fin_heures >= 1) AND ($horaire_fin_heures <= 9))
{
$zero_fin_heure = 0;
}
else
{
$zero_fin_heure = '';
}
echo '<infobulle_css3><a class="infobulle_css3">'.$zero_fin_heure.$horaire_fin_heures.'h'.$horaire_fin_minutes.'<span>Horaire fin: '.$zero_fin_heure.$horaire_fin_heures.'h'.$horaire_fin_minutes.'</span></a></infobulle_css3>';
}
else
{
// echo $i.'h';
}
?>
</td>
<?php
}
else
{
if(!empty($repos))
{
}
else
{
?><td nowrap="nowrap" style=""> </td><?php
}
}
}
?>
</tr>
<?php
} $reponses->closeCursor();
?>
</tbody>
</table>[/php]