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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
|
<?PHP
IF(!EMPTY($SessionIdSess))
{
SWITCH($Action)
{
CASE "RedSeance";
{
}
BREAK;
CASE "AjoutSeance";
{
ECHO '<FORM ACTION="index.php" METHOD="post">';
ECHO '<SELECT NAME="ClefCli">';
$REQClient =& $Connexion->QUERY("SELECT CONCAT(Nom,' ',Prenom,' - ',Ville) AS Client,ClefCli FROM $TBLClients WHERE ClefUti='$SessionClefSess'");
WHILE($RESClient =& $REQClient->fetchRow(DB_FETCHMODE_ASSOC))
{
ECHO '<OPTION VALUE="'.$RESClient[ClefCli].'"> '.$RESClient[Client].' </OPTION>';
}
ECHO '</SELECT>';
///Calendrier
if(isset($_GET["lundi"])) // Une semaine précise est demandée
{
$ts = $_GET["lundi"];
}
else //On prendra la semaine d'aujourd'hui
{
$day = (date('w') - 1); //Jour dans la semaine... Lundi = 0
$diff = $day * 86400; //Différence en secondes par rapport au lundi
$ts = (mktime() - $diff); //On récupère le TimeStamp du lundi
//$ts = mktime();
}
//Initialisation des variables
$week = date('W', $ts); //Semaine en cours
$avant = $ts - 604800; //TimeStamp Lundi précédant
$apres = $ts + 604800; //TimeStamp Lundi suivant
$ts2 = $ts;
$ts3 = $ts;
ECHO '<TABLE>
<TR>
<TD VALIGN="middle"><B>Lundi</B></TD>
<TD VALIGN="middle"><B>Mardi</B></TD>
<TD VALIGN="middle"><B>Mercredi</B></TD>
<TD VALIGN="middle"><B>Jeudi</B></TD>
<TD VALIGN="middle"><B>Vendredi</B></TD>
<TD VALIGN="middle"><B>Samedi</B></TD>
<TD VALIGN="middle"><B>Dimanche</B></TD>
</tr>
<tr>';
//Pour chaque jour de la semaine... Lundi = 1
$TBUDateHeure = ARRAY(ARRAY());
$TBUHoraire = ARRAY(ARRAY());
$TBUHoraireLS = ARRAY(ARRAY());
$LS = ARRAY(ARRAY());
for($i=1;$i<8;$i++)
{
$LS[1][$i]= "OK";
$LS[2][$i]= "OK";
$LS[3][$i]= "OK";
$LS[4][$i]= "OK";
$LS[5][$i]= "OK";
$LS[6][$i]= "OK";
$LS[7][$i]= "OK";
$LS[8][$i]= "OK";
$LS[9][$i]= "OK";
$LS[10][$i]= "OK";
$LS[11][$i]= "OK";
$LS[12][$i]= "OK";
$DateD = DATE("Y-m-d",$ts);
$TBUHoraireLS[1][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>09:00\n";
$TBUHoraireLS[2][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>09:45\n";
$TBUHoraireLS[3][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>10:30\n";
$TBUHoraireLS[4][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>11:15\n";
$TBUHoraireLS[5][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>12:00\n";
$TBUHoraireLS[6][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>13:45\n";
$TBUHoraireLS[7][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>14:30\n";
$TBUHoraireLS[8][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>15:15\n";
$TBUHoraireLS[9][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>16:00\n";
$TBUHoraireLS[10][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>16:45\n";
$TBUHoraireLS[11][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>17:30\n";
$TBUHoraireLS[12][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='' DISABLED>18:15\n";
$TBUHoraire[1][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 09:00:00'>09:00\n";
$TBUHoraire[2][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 09:45:00'>09:45\n";
$TBUHoraire[3][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 10:30:00'>10:30\n";
$TBUHoraire[4][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 11:15:00'>11:15\n";
$TBUHoraire[5][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 12:00:00'>12:00\n";
$TBUHoraire[6][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 13:45:00'>13:45\n";
$TBUHoraire[7][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 14:30:00'>14:30\n";
$TBUHoraire[8][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 15:15:00'>15:15\n";
$TBUHoraire[9][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 16:00:00'>16:00\n";
$TBUHoraire[10][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 16:45:00'>16:45\n";
$TBUHoraire[11][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 17:30:00'>17:30\n";
$TBUHoraire[12][$i] = "<INPUT TYPE='radio' NAME='DateRdv' VALUE='$DateD 18:15:00'>18:15\n";
$TBUDateHeure[1][$i] = "$DateD 09:00:00";
$TBUDateHeure[2][$i] = "$DateHeure 09:45:00";
$TBUDateHeure[3][$i] = "$DateHeure 10:30:00";
$TBUDateHeure[4][$i] = "$DateHeure 11:15:00";
$TBUDateHeure[5][$i] = "$Fzyr<hrutr 12:00:00";
$TBUDateHeure[6][$i] = "$DateHeure 12:45:00";
$TBUDateHeure[7][$i] = "$DateHeure 13:30:00";
$TBUDateHeure[8][$i] = "$DateHeure 14:15:00";
$TBUDateHeure[9][$i] = "$DDateHeure 15:00:00";
$TBUDateHeure[10][$i] = "$DateHeure 15:45:00";
$TBUDateHeure[11][$i] = "$DateHeure 17:30:00";
$TBUDateHeure[12][$i] = "$DateHeure 18:00:00";
//Il s'agit d'aujourd'hui!
if( ($i == date('w')) && ($week == date('W')))
{
ECHO '<td Valign="middle"><I>'.date("d M Y",$ts).'</I></td>';
}
else
{
echo '<TD VALIGN="middle">'.date("d M Y",$ts).'</TD>';
}
//On passe au jour suivant
$ts += 86400;
}
ECHO '</TR>';
FOR($M=1;$M<=8;$M++)
{
$D = DATE("Y-m-d",$ts2);
ECHO $D.'<BR>';
$REQSelectRdv =& $Connexion->QUERY("SELECT Date FROM $TBLRDV,$TBLClients WHERE $TBLRDV.ClefCli=$TBLClients.ClefCli AND $TBLClients.ClefUti='$SessionClefSess' AND Date LIKE '$D%'");
IF($REQSelectRdv->numRows()!=0)
{
while($RESSelectRdv =& $REQSelectRdv->fetchRow(DB_FETCHMODE_ASSOC))
{
IF($LS[1][$M]!=$RESSelectRdv[Date])
{
IF($RESSelectRdv[Date]=="$D 09:00:00")
{
$LS[1][$M] = $RESSelectRdv[Date];
}
IF($RESSelectRdv[Date]=="$D 09:45:00")
{
$LS[1][$M] = $RESSelectRdv[Date];
}
ELSEIF($RESSelectRdv[Date]=="$D 10:30:00")
{
$LS[3][$M] = $RESSelectRdv[Date];
}
ELSEIF($RESSelectRdv[Date]=="$D 11:15:00")
{
$LS[4][$M] = $RESSelectRdv[Date];
}
}
}
}
$ts2 += 86400;
}
FOR($J=1;$J<=12;$J++)
{
ECHO '<TR>';
FOR($I=1;$I<8;$I++)
{
IF($LS[$J][$I]==$TBUDateHeure[$J][$I])
{
ECHO '<TD VALIGN="middle">'.$TBUHoraireLS[$J][$I].'</TD>';
}
ELSE
{
ECHO '<TD VALIGN="middle">'.$TBUHoraire[$J][$I].'</TD>';
}
}
ECHO '</TR>';
}
ECHO '<TR>';
ECHO '<TD VALIGN="middle" COLSPAN="2"><A HREF="index.php?Page=Rdv&Action=AjoutSeance&lundi='.$avant.'">Semaine Précédente</A></TD>';
ECHO '<TD VALIGN="middle">Semaine '.$week.'</TD>';
ECHO '<TD VALIGN="middle" COLSPAN="2"><A HREF="index.php?Page=Rdv&Action=AjoutSeance&lundi='.$apres.'">Semaine Suivante</A></TD>';
ECHO '</TR>';
ECHO '</table>';
ECHO '<INPUT TYPE="hidden" NAME="Page" VALUE="Rdv">';
ECHO '<INPUT TYPE="hidden" NAME="Action" VALUE="AjoutSeance2">';
ECHO '<INPUT TYPE="submit" NAME="Valider" VALUE="Réserver">';
ECHO '</FORM>';
}
BREAK;
CASE "AjoutSeance2";
{
$ClefCli = $_POST[ClefCli];
$DateRdv = $_POST[DateRdv];
$REQInsertRdv =& $Connexion->QUERY("INSERT INTO $TBLRDV VALUES('','$ClefCli','$DateRdv',\"$Commentaire\")");
IF(DB::isError($REQInsertRdv))
{
?>
<SCRIPT>
alert('Erreur d\'insertion du RDV')
</SCRIPT>
<?php
}
ELSE
{
?>
<SCRIPT>
alert('Rendez-vous du <?=DateFR($DateRdv,0)?> réservé !')
</SCRIPT>
<?php
}
PRINT("<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=index.php\">");
}
BREAK;
DEFAULT;
{
?>
<A HREF="index.php?Page=Rdv&Action=AjoutSeance">Ajouter une nouvelle séance</A><BR>
<A HREF="index.php?Page=Rdv&Action=RedSeance">Rédaction compte-rendu</A>
<?
}
BREAK;
}
}
ELSE
{
INCLUDE("Erreur.php");
}
?> |
Partager