Heure
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
01
L
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 1 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
Ma
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 2 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
Me
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 3 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
J
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 4 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
V
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 5 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
S
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 6 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
D
prepare('SELECT title, description, color, length FROM planning_insa WHERE day = 7 AND num_planning = ? ORDER BY order_start ASC');
$req1->execute(array($planning));
while($r1 = $req1->fetch()) {
?>
= $r1['title'] ?>
https://github.com/baptistereb/php2ics)
include("assets/script/php2ics.php");
if(isset($_POST['download_planning'])) {
$cal = new php2ics("accueil_insa", "voila les loustiks");
for($day = 1; $day <= 7; $day++) { //on tourne sur les 7 jours
$hours_beginning = (int) 7; //commence à 7h tout les matin
$day_beginning = (int) 5; //commence le 5 septembre (premier jour = 5 septembre)
$hours = $hours_beginning;
$minute = 0;
$reqcal = $db->prepare('SELECT id,title, description, length FROM planning_insa WHERE day = ? AND num_planning = ? ORDER BY order_start ASC');
$reqcal->execute(array($day, $planning));
while($c = $reqcal->fetch()) {
//le planning commence à $hours_beginning le $day_beginning et sous forme : date('Y-m-d H:i:s')
if($c['title'] == " ") { //si le titre est vide c'est qu'il n'y a rien
$time = (float) $c['length']/4.1;
$hours += floor($time);
$minute += 60*($time-floor($time));
} else {
$begin_hours = $hours;
$begin_min = $minute;
$time = (float) $c['length']/4.1;
$hours += floor($time);
$minute += round(60*($time-floor($time)),3);
while($minute >= 60) {
$minute -= 60;
$hours++;
}
while($hours >= 24) {
$hours --; //bon la on tronque entre les jours sinon c'est hyper relou à coder pour rien
}
//pour tester décommenter la ligne juste en dessous
//echo $c['title'].": ".$begin_hours.'h'.$begin_min.'m to :'.$hours.'h'.$minute.'m