Bon be voila finalement j'ai laché le code et.. j'en ai fait un autre qui fonctionne ...
maintenant il faudrait que tout se fasse sur une page, je ne sais pas si c'est possible...
Le principe : une boucle génere les timestamp des mois , on en selectionne un et donc on envoie le timestamp sur une autre page php qui s'en servira pour afficher le calendrier...
La il y a 2 pages,... avec une seule page c'est possible???
Mercii et @+++
l
ps pour l'affichage deso c du repompé du net mais ce qui m'interresse le plus pour l'instant c le code , je ferai mes css plus tard....
page d'accueil:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Document sans titre</title>
</head>
<body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHPcal_Accueil</title>
</head>
<body>
<?php
/**************************************************************************************************/
//calendrier
echo"-------choisir le mois dans la liste et appuyer sur le bouton Sélectionner-----------------------------------";
//echo "<br> zone test : date de aujourd 'hui: " ;echo date("a\A\B\c\d\D\F\G\h\H\j\J\l\L\m\M\n\o\r\S\t\T\U\w\W\Y\y\z\Z");
//echo"<br>------------------------------------------";
for($i=1;$i>=date("t");$i++)//t-->nombre de jours dans le mois
//pourquoi??
echo $i;
//pourquoi??
{
date("w", mktime(0,0,0,date("n"), 1, date("Y")));
echo "<form method='post' action='phpcal_horaire1.php' enctype='multipart/form-data'>";
//<form action=\"$PHP_SELF" method=\"post\">";
echo '<select name="instant" size="1">';
$date_inf= mktime(0,0,0,date("n")-14, date("j"), date("Y"));
$date_sup= mktime(0,0,0,date("n")+12, date("j"), date("Y"));
$mois_franc=array('', 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'âout', 'septembre', 'octobre', 'novembre', 'decembre');
for ($variable_mois=-14,$variable_tableau=date("n",$date_inf);$variable_mois<=12;$variable_mois++,$variable_tableau++)
{
if($variable_tableau==13){
$variable_tableau=1;
}
$chronos=mktime(0,0,0,date("n")+$variable_mois, date("j"),date("Y"));
echo "<option value=\"$chronos\"";
if(!$variable_mois){
echo ' SELECTED';
}
$mois_courant=$mois_franc["$variable_tableau"];
$an_courant=date("Y", $chronos);
echo ">$mois_courant ${an_courant}</option>";
}
echo"<input name=\"Submit\" type=\"Submit\" id=\"Submit\" value=\"Selectionner\"></form>";
$instant=mktime(0,0,0,date("n"), date("j"), date("Y"));
$mois=date("n","$instant");
// echo "<br>$mois";
$mois_en_franc=$mois_franc["$mois"];
$annee =date("Y","$instant");
}
?>
</body>
</html>
page du calendrier :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHP MY ROOM</title>
<style type="text/css">
.gestion-calendar {
width: 203px;
border: 1px solid #000000;
background-color: #FFFFFF;
}
.gestion-calendar-month {
border-bottom: 1px solid #000000;
background-color: #F0E68C;
font-family: Helvetica;
font-size: 11pt;
font-weight: bold;
text-align: center;
vertical-align: middle;
color: #000000;
}
.gestion-calendar-day {
width: 25px;
height: 25px;
background-color: #F6F6F6;
font-family: Helvetica;
font-size: 10pt;
font-weight: normal;
text-align: center;
vertical-align: middle;
margin: 0px;
padding: 0px;
}
.gestion-calendar-today {
width: 25px;
height: 25px;
background-color: #F0E68C;
font-family: Helvetica;
font-size: 10pt;
font-weight: normal;
text-align: center;
vertical-align: middle;
margin: 0px;
padding: 0px;
}
.gestion-calendar-dayname {
width: 25px;
height: 25px;
background-color: #F6F6F6;
font-family: Helvetica;
font-size: 10pt;
font-weight: bold;
text-align: center;
vertical-align: middle;
margin: 0px;
padding: 0px;
}
.gestion-calendar-date {
text-align: center;
vertical-align: middle;
padding: 3px;
}
.Style1 {color: #0099FF}
.Style2 {
color: #FF0000;
font-weight: bold;
}
.Style4 {font-size: 12px}
</style>
</head>
<body>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php
$instant = $_POST['instant'];
//echo"<br>Infos utiles";
//echo "<br>--var instant ( timestamp )-- : " ; //echo $instant;
$chaine=date("F Y",$instant);
//echo "<br>--var_chaine :-- $chaine";
$MC=date("n",$instant);
//echo "<br>MC--Mois cherché:$MC";
$AC=date("Y",$instant);
//echo "<br>AC--Année cherchée:$AC";
if(date("L",$instant)==1){
echo"<br>année bissextile";
}
//echo "<br>fin des infos...";
/*Lire $MC et $AC*/
/*Déclaration de variables*/
$jour=array('Sa','Di','Lu','Ma','Me','Je','Ve','Sa',' ');
$NJM=array(' ','31','28','31','30','31','30','31','31','30','31','30','31');//Nombre Jour du Mois
$IPJM01=array(' ','2','5','5','1','3','6','1','4','0','2','5','0');//Index Position Jour du Mois année 2001
/* 1°)Calcul de la position dans la semaine du premier jour du mois de l'année cherchée.c'est un nombre compris entre
1 et 7 sachant que 1 est le dimanche du (AC_)??*/
$IPJMAC=$IPJM01["$MC"];//IndexPositionJourMoisAnnéeCherchée=IndexPositionJourMois2001 en position(MC)
//echo"<br>***DEBUG:***<br>tab_jour:"; print_r ($jour);
//echo"<br>tab_NJM:"; print_r ($NJM);
//echo"<br>tab_IPJM01:"; print_r ($IPJM01);
//echo"<br>tab_IPJM01à l'endroit MC:"; print_r ($IPJM01["$MC"]);
//echo"<br>var_IPJMAC:"; print_r ($IPJMAC);
//echo "<br>***fin DEBUG***";
$NJAA=0;//Nombre de Jour A Ajouter
for ( $IA=2001; $IA<$AC; $IA++ ){//Index année
//echo"<br>var IA: $IA";
$NJA=365;//NombreJour Ajouté
if($IA%4==0){
//echo"<br>var_NJA:$NJA";
$NJA=366;
}
$NJAA=$NJAA+$NJA;
//echo"<br>varNJAA:$NJAA";
}
if($AC%4==0 && $MC>2){
$NJAA=$NJAA+1;
}
$NPP=$IPJMAC+$NJAA;//NPP variable de travail
$IPJMAC=($NPP%7);
if($IPJMAC==0){
$IPJMAC=7;
}
//echo"<br>";
//echo"<br>NPP:$NPP";
//echo"<br>IPJMAC:$IPJMAC";
//echo"<br>";
/*pour MC de AC le premier jour est : $jour['$IPJMAC']
/* 2°)Création du calendrier du mois de l'année recherchée:*/
for($i=1;$i<50;$i++){//$i est un compteur de cellules du calendrier
if($i<8){
//$calendrier["$i"]=$jour["$i"];
$calendrier["$i"]=$jour["$i"];
}
else{
$calendrier["$i"]=$jour[8];
//$calendrier["$i"]='<td class="gestion-calendar-today">$jour[8]</td>';
}
}
$NJMC=$NJM["$MC"];//NombreJourMoisCourant=NombrJourMois a la position MC
if($MC==2 && $MC%4==0){
$NJMC=29;
}
$IPJMAC=$IPJMAC+7;
$IDJMAC=$IPJMAC+$NJMC;//IndexDernierJourMoisAnnéeCherchée=IndexPositionJourMoisAnéeCherchée+NombreJourMoisCourant
$NJ=0;//NombreJour=0
/* 3°)Remplissagte du calendrier crée*/
for($J=$IPJMAC;$J<$IDJMAC;$J++){
$NJ=$NJ+1;
$calendrier["$J"]=$NJ;//NJ = maximum 31
}
//echo"<br>";print_r($calendrier);
if($IDJMAC<44){//si NombreJourMoisAnnéeCourant+7<43
$NCELL=43;
}
else{
$NCELL=49;//NombreCELLules
}
/*Affichage du tableau*/
// echo"<br>";
$time=time();//echo"var_time:$time";//time stamp de maintenant
//echo"<br>";
//echo"var_instant:$instant";//timestamp passé depuis les mois choisi
//echo"<br>";
$MAC=date("n Y",$instant);//MoisAnnéeCherché=mois et année du timestamp $instant
$MACM=date("n Y",$time);// MoisannéeCherchéMaintenant= mois et année du timestamp $time-->mois et année du jour d'éxecution de cette page
//echo"<br>MAC-->$MAC";
//echo"<br>MACM-->$MACM";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" align=\"left\" class=\"gestion-calendar\">";
echo " <tr>";
echo " <td class=\"gestion-calendar-month\" colspan=\"7\">$MC" ;echo" ";echo $AC; echo"</td>";
echo " </tr>";
echo " <tr>";
for($i=1;$i<8;$i++){
echo '<td class="gestion-calendar-dayname">'.$calendrier["$i"]; echo"</td>";
}
echo " </tr>";
echo " <tr>";
for($i=8;$i<15;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
echo " <tr>";
for($i=15;$i<22;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
echo " <tr>";
for($i=22;$i<29;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
echo " <tr>";
for($i=29;$i<36;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
echo " <tr>";
for($i=36;$i<43;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
if($NCELL==49){
echo " <tr>";
for($i=43;$i<50;$i++){
if($MAC==$MACM && $calendrier["$i"] == date("j",$time)){
echo '<td class="gestion-calendar-today"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
else{
echo '<td class="gestion-calendar-dayname"><a href=\"#\" target=\"_self\">'.$calendrier["$i"]; echo"</a></td>";
}
}
echo " </tr>";
}
echo "</table>";
?>
</td>
<td><table width="237" border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="2">Légende</td>
</tr>
<tr>
<td colspan="2">Clic sur le jour pour voir l'horaire</td>
</tr>
<tr>
<td width="25" class="gestion-calendar-today"> </td>
<td width="209" >Ajourd'hui</td>
</tr>
<tr>
<td class="gestion-calendar-dayname"> </td>
<td >Jours de ce mois</td>
</tr>
</table></td>
<td>ici sera placé le selecteur de mois...</td>
</tr>
</table>
</body>
</html>
@++++elegman :) :)