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
|
if (isset($_POST["time"])) {
require_once 'Zend/Loader.php';
require_once 'Zend/Gdata/Calendar.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "*********@gmail.com";
$pass = "*********";
// Create an authenticated HTTP client
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
// Create an instance of the Calendar service
$service = new Zend_Gdata_Calendar($client);
$cal = new Zend_Gdata_Calendar($client);
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$service = new Zend_Gdata_Calendar($client);
$eventURL = "https://www.google.com/calendar/feeds/phoneglasstoulouse%40gmail.com/private-7ee50cdf1fabe5ab581d44d425059c0a/basic";
// Create a new entry using the calendar service's magic factory method
$event= $service->newEventEntry();
// Populate the event with the desired information
// Note that each attribute is crated as an instance of a matching class
$event->title = $service->newTitle("My Event");
$event->where = array($service->newWhere("Mountain View, California"));
$event->content =
$service->newContent(" This is my awesome event. RSVP required.");
// Set the date using RFC 3339 format.
$durée = 30;
$min_fin = split("[:T]", $_POST["time"]);
$min= $min_fin[2] + $durée;
$h=$min_fin[1];
if ($min>=60){
$min=$min-60;
$h=$h+1;
}
$time_fin = $min_fin[0]."T".$h.":".$min.":".$min_fin[3].":".$min_fin[4];
echo $time_fin;
$when = $service->newWhen();
$when->startTime = $_POST["time"];
$when->endTime = $time_fin;
$event->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$newEvent = $service->insertEvent($event);
}
<table id="plages">
<tr>
<th></th>
<th colspan="4">10h</th>
<th colspan="4">11h</th>
<th colspan="4">12h</th>
<th colspan="4">13h</th>
<th colspan="4">14h</th>
<th colspan="4">15h</th>
<th colspan="4">16h</th>
<th colspan="4">17h</th>
<th colspan="4">18h</th>
<th colspan="4">19h</th>
</tr>
<?php
$jour = array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
$mois = array("","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
$mois_nbr = array("","01","02","03","04","05","06","07","08","09","10","11","12");
date_default_timezone_set('Europe/Paris');
$now = time();
$then = strtotime('+8 days', $now); // dans 4 semaines
$current = $now;
do {
if (date('D', $current) == 'Sun') // ou Dim selon la locale
continue;
$dateDuJour[] = $jour[date("w",$current)]." ".date("d",$current)." ".$mois[date("n",$current)]." ".date("Y",$current);
$format_heur[] = date("Y",$current)."-".$mois_nbr[date("n",$current)]."-".date("d",$current)."T";
} while (($current = strtotime('+1 days', $current)) && $current <= $then);
echo '<tr><th>'.$dateDuJour[0].'</th><td time="'.$format_heur[0].'10:00:00.000+02:00">00</td><td time="'.$format_heur[0].'10:20:00.000+02:00">20</td><td time="'.$format_heur[0].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'11:00:00.000+02:00">00</td><td time="'.$format_heur[0].'11:20:00.000+02:00">20</td><td time="'.$format_heur[0].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'12:00:00.000+02:00">00</td><td time="'.$format_heur[0].'12:20:00.000+02:00">20</td><td time="'.$format_heur[0].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'13:00:00.000+02:00">00</td><td time="'.$format_heur[0].'13:20:00.000+02:00">20</td><td time="'.$format_heur[0].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[0].'16:00:00.000+02:00">00</td><td time="'.$format_heur[0].'16:20:00.000+02:00">20</td><td time="'.$format_heur[0].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'17:00:00.000+02:00">00</td><td time="'.$format_heur[0].'17:20:00.000+02:00">20</td><td time="'.$format_heur[0].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'18:00:00.000+02:00">00</td><td time="'.$format_heur[0].'18:20:00.000+02:00">20</td><td time="'.$format_heur[0].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[0].'19:00:00.000+02:00">00</td><td time="'.$format_heur[0].'19:20:00.000+02:00">20</td><td time="'.$format_heur[0].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[1].'</th><td time="'.$format_heur[1].'10:00:00.000+02:00">00</td><td time="'.$format_heur[1].'10:20:00.000+02:00">20</td><td time="'.$format_heur[1].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'11:00:00.000+02:00">00</td><td time="'.$format_heur[1].'11:20:00.000+02:00">20</td><td time="'.$format_heur[1].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'12:00:00.000+02:00">00</td><td time="'.$format_heur[1].'12:20:00.000+02:00">20</td><td time="'.$format_heur[1].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'13:00:00.000+02:00">00</td><td time="'.$format_heur[1].'13:20:00.000+02:00">20</td><td time="'.$format_heur[1].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[1].'16:00:00.000+02:00">00</td><td time="'.$format_heur[1].'16:20:00.000+02:00">20</td><td time="'.$format_heur[1].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'17:00:00.000+02:00">00</td><td time="'.$format_heur[1].'17:20:00.000+02:00">20</td><td time="'.$format_heur[1].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'18:00:00.000+02:00">00</td><td time="'.$format_heur[1].'18:20:00.000+02:00">20</td><td time="'.$format_heur[1].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[1].'19:00:00.000+02:00">00</td><td time="'.$format_heur[1].'19:20:00.000+02:00">20</td><td time="'.$format_heur[1].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[2].'</th><td time="'.$format_heur[2].'10:00:00.000+02:00">00</td><td time="'.$format_heur[2].'10:20:00.000+02:00">20</td><td time="'.$format_heur[2].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'11:00:00.000+02:00">00</td><td time="'.$format_heur[2].'11:20:00.000+02:00">20</td><td time="'.$format_heur[2].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'12:00:00.000+02:00">00</td><td time="'.$format_heur[2].'12:20:00.000+02:00">20</td><td time="'.$format_heur[2].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'13:00:00.000+02:00">00</td><td time="'.$format_heur[2].'13:20:00.000+02:00">20</td><td time="'.$format_heur[2].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[2].'16:00:00.000+02:00">00</td><td time="'.$format_heur[2].'16:20:00.000+02:00">20</td><td time="'.$format_heur[2].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'17:00:00.000+02:00">00</td><td time="'.$format_heur[2].'17:20:00.000+02:00">20</td><td time="'.$format_heur[2].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'18:00:00.000+02:00">00</td><td time="'.$format_heur[2].'18:20:00.000+02:00">20</td><td time="'.$format_heur[2].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[2].'19:00:00.000+02:00">00</td><td time="'.$format_heur[2].'19:20:00.000+02:00">20</td><td time="'.$format_heur[2].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[3].'</th><td time="'.$format_heur[3].'10:00:00.000+02:00">00</td><td time="'.$format_heur[3].'10:20:00.000+02:00">20</td><td time="'.$format_heur[3].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'11:00:00.000+02:00">00</td><td time="'.$format_heur[3].'11:20:00.000+02:00">20</td><td time="'.$format_heur[3].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'12:00:00.000+02:00">00</td><td time="'.$format_heur[3].'12:20:00.000+02:00">20</td><td time="'.$format_heur[3].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'13:00:00.000+02:00">00</td><td time="'.$format_heur[3].'13:20:00.000+02:00">20</td><td time="'.$format_heur[3].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[3].'16:00:00.000+02:00">00</td><td time="'.$format_heur[3].'16:20:00.000+02:00">20</td><td time="'.$format_heur[3].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'17:00:00.000+02:00">00</td><td time="'.$format_heur[3].'17:20:00.000+02:00">20</td><td time="'.$format_heur[3].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'18:00:00.000+02:00">00</td><td time="'.$format_heur[3].'18:20:00.000+02:00">20</td><td time="'.$format_heur[3].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[3].'19:00:00.000+02:00">00</td><td time="'.$format_heur[3].'19:20:00.000+02:00">20</td><td time="'.$format_heur[3].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[4].'</th><td time="'.$format_heur[4].'10:00:00.000+02:00">00</td><td time="'.$format_heur[4].'10:20:00.000+02:00">20</td><td time="'.$format_heur[4].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'11:00:00.000+02:00">00</td><td time="'.$format_heur[4].'11:20:00.000+02:00">20</td><td time="'.$format_heur[4].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'12:00:00.000+02:00">00</td><td time="'.$format_heur[4].'12:20:00.000+02:00">20</td><td time="'.$format_heur[4].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'13:00:00.000+02:00">00</td><td time="'.$format_heur[4].'13:20:00.000+02:00">20</td><td time="'.$format_heur[4].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[4].'16:00:00.000+02:00">00</td><td time="'.$format_heur[4].'16:20:00.000+02:00">20</td><td time="'.$format_heur[4].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'17:00:00.000+02:00">00</td><td time="'.$format_heur[4].'17:20:00.000+02:00">20</td><td time="'.$format_heur[4].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'18:00:00.000+02:00">00</td><td time="'.$format_heur[4].'18:20:00.000+02:00">20</td><td time="'.$format_heur[4].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[4].'19:00:00.000+02:00">00</td><td time="'.$format_heur[4].'19:20:00.000+02:00">20</td><td time="'.$format_heur[4].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[5].'</th><td time="'.$format_heur[5].'10:00:00.000+02:00">00</td><td time="'.$format_heur[5].'10:20:00.000+02:00">20</td><td time="'.$format_heur[5].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'11:00:00.000+02:00">00</td><td time="'.$format_heur[5].'11:20:00.000+02:00">20</td><td time="'.$format_heur[5].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'12:00:00.000+02:00">00</td><td time="'.$format_heur[5].'12:20:00.000+02:00">20</td><td time="'.$format_heur[5].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'13:00:00.000+02:00">00</td><td time="'.$format_heur[5].'13:20:00.000+02:00">20</td><td time="'.$format_heur[5].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[5].'16:00:00.000+02:00">00</td><td time="'.$format_heur[5].'16:20:00.000+02:00">20</td><td time="'.$format_heur[5].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'17:00:00.000+02:00">00</td><td time="'.$format_heur[5].'17:20:00.000+02:00">20</td><td time="'.$format_heur[5].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'18:00:00.000+02:00">00</td><td time="'.$format_heur[5].'18:20:00.000+02:00">20</td><td time="'.$format_heur[5].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[5].'19:00:00.000+02:00">00</td><td time="'.$format_heur[5].'19:20:00.000+02:00">20</td><td time="'.$format_heur[5].'19:40:00.000+02:00">40</td></tr><tr><th>'.$dateDuJour[6].'</th><td time="'.$format_heur[6].'10:00:00.000+02:00">00</td><td time="'.$format_heur[6].'10:20:00.000+02:00">20</td><td time="'.$format_heur[6].'10:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'11:00:00.000+02:00">00</td><td time="'.$format_heur[6].'11:20:00.000+02:00">20</td><td time="'.$format_heur[6].'11:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'12:00:00.000+02:00">00</td><td time="'.$format_heur[6].'12:20:00.000+02:00">20</td><td time="'.$format_heur[6].'12:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'13:00:00.000+02:00">00</td><td time="'.$format_heur[6].'13:20:00.000+02:00">20</td><td time="'.$format_heur[6].'13:40:00.000+02:00">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td time="'.$format_heur[6].'16:00:00.000+02:00">00</td><td time="'.$format_heur[6].'16:20:00.000+02:00">20</td><td time="'.$format_heur[6].'16:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'17:00:00.000+02:00">00</td><td time="'.$format_heur[6].'17:20:00.000+02:00">20</td><td time="'.$format_heur[6].'17:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'18:00:00.000+02:00">00</td><td time="'.$format_heur[6].'18:20:00.000+02:00">20</td><td time="'.$format_heur[6].'18:40:00.000+02:00">40</td><th> </th><td time="'.$format_heur[6].'19:00:00.000+02:00">00</td><td time="'.$format_heur[6].'19:20:00.000+02:00">20</td><td time="'.$format_heur[6].'19:40:00.000+02:00">40</td></tr>';
?>
</table>
<form action="calendrier" method="post">
<input type="text" id="time" name="time" value="" />
<input type="submit" value="Réserver" />
</form>
<script type="text/javascript">
$(function () {
$('#plages td:not(.picked)').click(function () {
$('#plages td').removeClass('clicked');
$(this).toggleClass('clicked');
$('#time').val( $(this).attr('time') );
});
});
</script> |