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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
|
<?php
$id=$_GET['ident'];
$action=$_GET['action'];
include "include/fonctions.php";
$boutonavant=isset($_POST['avant'])?$_POST['avant']:null;
$boutonapres=isset($_POST['apres'])?$_POST['apres']:null;
// Une semaine précise est demandée
if(isset($_GET["lundi"])) {
$ts = $_GET["lundi"];
}
//On prendra la semaine d'aujourd'hui
else {
$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
}
//Initialisation des variables
$avant = $ts - 604800; //TimeStamp Lundi précédant
$apres = $ts + 604800; //TimeStamp Lundi suivant
if ($boutonavant=="<<") {
$semsel=$avant;
$week = date('W', $semsel);
}
else {
if ($boutonapres==">>") {
$semsel=$apres;
$week = date('W', $semsel);
}
else{
$semsel=$ts;
$week = date('W', $semsel); //Semaine en cours
}
}
$jour1=$semsel;
?>
<html>
<head>
<title>Planning par semaine</title>
<SCRIPT type="text/JavaScript">
function OuvrirPopup(page) {
window.open(page,'popuprdv','width=500,height=300,toolbar=no,scrollbars=no,menubar=no,status=no');
}
</script>
</head>
<body style="color: rgb(0, 0, 0); background-color: rgb(100, 255, 111);" alink="#000099" link="#000099" vlink="#990099">
<?php
include "include/entetepage.php";
include"include/client.inc.php";
?>
<form action="<?php echo($_SERVER['PHP_SELF'])?>?ident=<?php echo ($id) ?>&action=<?php echo ($action) ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&lundi=<?echo $semsel;?>" method="post" id="chgpage">
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<?php
include "include/centreprest.inc.php";
?>
</tr>
</tbody>
</table>
<?php
if ($client[prestataire]>"0") { ?>
<div align="center">
<?php
echo "<br>";
?>
<input type="submit" name="avant" id="avant" value="<<" onclick="document.forms['chgpage'].submit();">
Semaine <?echo $week;?>
<input type="submit" name="apres" id="apres" value=">>" onclick="document.forms['chgpage'].submit();">
</div>
<table align="center" border="1" width="96%">
<tr>
<td align="center" width="12%"></td>
<td align="center" width="12%"><b>Lundi</b></td>
<td align="center" width="12%"><b>Mardi</b></td>
<td align="center" width="12%"><b>Mercredi</b></td>
<td align="center" width="12%"><b>Jeudi</b></td>
<td align="center" width="12%"><b>Vendredi</b></td>
<td align="center" width="12%"><b>Samedi</b></td>
<td align="center"width="12%"><b>Dimanche</b></td>
</tr>
<tr>
<td align="center" width="12%"></td>
<?php
//Pour chaque jour de la semaine... Lundi = 1
for($i=1;$i<8;$i++) {
//Il s'agit d'aujourd'hui!
if(($i == date('w')) && ($week == date('W'))) { ?>
<td align="center" style="background-color:#FFFF00;" onClick="OuvrirPopup('rdv.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
echo datereduiteFr($semsel);
?>
</td>
<?php
}
else { ?>
<td align="center" style="background-color:#FFFFFF;" onClick="OuvrirPopup('rdv.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
echo datereduiteFr($semsel);
?>
</td>
<?php
}
$semsel += 86400; //On passe au jour suivant
} ?>
</tr>
<?php
$semsel=$jour1;
?>
<tr>
<td align="center" width="12%">Matin
</td>
<?php
//Pour chaque jour de la semaine... Lundi = 1
for($i=1;$i<8;$i++) {
$daterech=date("Y-m-d",$semsel);
/*echo $daterech;*/
connectMaBase();
$sql = "SELECT * FROM `Planning` WHERE `Date`='$daterech' AND `Prestataire`='$client[prestataire]' ORDER BY `Heuredeb`";
$rech_rdv = mysql_query($sql);
$code_rdv = array();
$date_rdv = array();
$activite_rdv=array();
$hdeb_rdv = array();
$hfin_rdv = array();
$client_rdv=array();
$prestataire_rdv = array();
$centre_rdv = array();
$encodeur_rdv=array();
$modifiable_rdv=array();
$nb_rdv = 0;
if($rech_rdv != false) {
while($lignerdv = mysql_fetch_assoc($rech_rdv)) {
array_push($code_rdv, $lignerdv['Id']);
array_push($date_rdv, $lignerdv['Date']);
array_push($activite_rdv,$lignerdv['Activite']);
array_push($hdeb_rdv, $lignerdv['Heuredeb']);
array_push($hfin_rdv, $lignerdv['Heurefin']);
array_push($client_rdv,$lignerdv['Client']);
array_push($prestataire_rdv,$lignerdv['Prestataire']);
array_push($centre_rdv, $lignerdv['Centre']);
array_push($encodeur_rdv, $lignerdv['Encodeur']);
array_push($modifiable_rdv,$lignerdv['Modifiable']);
/* On incrémente le compteur */
$nb_rdv++;
}
}
mysql_free_result($rech_rdv);
mysql_close();
//Il s'agit d'aujourd'hui!
if(($i == date('w')) && ($week == date('W'))) { ?>
<td align="center" style="background-color:#FFFF00;" onClick="OuvrirPopup('rdvam.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
if ($nb_rdv>0) {
for ($j = 0; $j < $nb_rdv; $j++) {
if ($hdeb_rdv[$j]<="12:00:00") {
echo ($client_rdv[$j]."<br>");
echo ("De ".substr($hdeb_rdv[$j],0,5)." à ".substr($hfin_rdv[$j],0,5)."<br>");
echo ($activite_rdv[$j]."<br>");
}
}
}
echo "<br>";
?>
</td>
<?php
}
else { ?>
<td align="center" style="background-color:#FFFFFF;" onClick="OuvrirPopup('rdvam.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
if ($nb_rdv>0) {
for ($j = 0; $j < $nb_rdv; $j++) {
if ($hdeb_rdv[$j]<="12:00:00") {
echo ($client_rdv[$j]."<br>");
echo ("De ".substr($hdeb_rdv[$j],0,5)." à ".substr($hfin_rdv[$j],0,5)."<br>");
echo ($activite_rdv[$j]."<br>");
}
}
}
echo "<br>";
?>
</td>
<?php
}
$semsel += 86400; //On passe au jour suivant
} ?>
</tr>
<?php
$semsel=$jour1;
?>
<tr>
<td align="center" width="12%">Après-midi</td>
<?php
//Pour chaque jour de la semaine... Lundi = 1
for($i=1;$i<8;$i++) {
$daterech=date("Y-m-d",$semsel);
/*echo $daterech;*/
connectMaBase();
$sql = "SELECT * FROM `Planning` WHERE `Date`='$daterech' AND `Prestataire`='$client[prestataire]' ORDER BY `Heuredeb`";
$rech_rdv = mysql_query($sql);
$code_rdv = array();
$date_rdv = array();
$activite_rdv=array();
$hdeb_rdv = array();
$hfin_rdv = array();
$client_rdv=array();
$prestataire_rdv = array();
$centre_rdv = array();
$encodeur_rdv=array();
$modifiable_rdv=array();
$nb_rdv = 0;
if($rech_rdv != false) {
while($lignerdv = mysql_fetch_assoc($rech_rdv)) {
array_push($code_rdv, $lignerdv['Id']);
array_push($date_rdv, $lignerdv['Date']);
array_push($activite_rdv,$lignerdv['Activite']);
array_push($hdeb_rdv, $lignerdv['Heuredeb']);
array_push($hfin_rdv, $lignerdv['Heurefin']);
array_push($client_rdv,$lignerdv['Client']);
array_push($prestataire_rdv,$lignerdv['Prestataire']);
array_push($centre_rdv, $lignerdv['Centre']);
array_push($encodeur_rdv, $lignerdv['Encodeur']);
array_push($modifiable_rdv,$lignerdv['Modifiable']);
/* On incrémente le compteur */
$nb_rdv++;
}
}
mysql_free_result($rech_rdv);
mysql_close();
//Il s'agit d'aujourd'hui!
if(($i == date('w')) && ($week == date('W'))) { ?>
<td align="center" style="background-color:#FFFF00;" onClick="OuvrirPopup('rdvpm.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
if ($nb_rdv>0) {
for ($j = 0; $j < $nb_rdv; $j++) {
if ($hdeb_rdv[$j]>="12:30:00") {
echo ($client_rdv[$j]."<br>");
echo ("De ".substr($hdeb_rdv[$j],0,5)." à ".substr($hfin_rdv[$j],0,5)."<br>");
echo ($activite_rdv[$j]."<br>");
}
}
}
echo "<br>";
?>
</td>
<?php
}
else { ?>
<td align="center" style="background-color:#FFFFFF;" onClick="OuvrirPopup('rdvpm.php?jour=<?php echo ($semsel); ?>¢re=<?php echo ($client[centre]); ?>&prestataire=<?php echo ($client[prestataire]); ?>&ident=<?php echo ($id); ?>&action=1')">
<?php
if ($nb_rdv>0) {
for ($j = 0; $j < $nb_rdv; $j++) {
if ($hdeb_rdv[$j]>="12:30:00") {
echo ($client_rdv[$j]."<br>");
echo ("De ".substr($hdeb_rdv[$j],0,5)." à ".substr($hfin_rdv[$j],0,5)."<br>");
echo ($activite_rdv[$j]."<br>");
}
}
}
echo "<br>";
?>
</td>
<?php
}
$semsel += 86400; //On passe au jour suivant
} ?>
</tr>
</table>
<?php
} ?>
</form>
</body>
</html> |
Partager