From 05ff9140d5de5dd79e35ff08cc1c3f59a29e9ab8 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Sat, 15 Oct 2022 17:27:39 +0200 Subject: [PATCH] c'est la bonne j'espere ! --- README.md | 10 ++++++++++ assets/scripts/php2ics.php | 5 ++++- assets/scripts/planning_tmp.php | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 assets/scripts/planning_tmp.php diff --git a/README.md b/README.md index d7d1c5f..98f4ceb 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,16 @@ il n'y a globalement pas grand chose à comprendre à part qu'ici la taille (len Tout est modifiable via le panel admin (voir la section "admin" plus bas dans ce readme). +### planning_tmp_dl + +| Nom | Type | AUTO_INCREMENT | NULL | +| :----------- |:------------:|:---------------:|:-----:| +| planning | text | | | + +permet d'enregistrer l'ics pour le téléchargement voir la section "planning" à propos du script php2ics. + +Par défaut il faut avoir une seule ligne vide, le script se chargera de la modifier à chaque fois. + ### scores | Nom | Type | AUTO_INCREMENT | NULL | diff --git a/assets/scripts/php2ics.php b/assets/scripts/php2ics.php index 92db461..9ed82db 100644 --- a/assets/scripts/php2ics.php +++ b/assets/scripts/php2ics.php @@ -143,7 +143,10 @@ if(isset($_POST['download_planning'])) { $cal->End(); - $cal->DownloadICS("planning_SA_INSA"); + $req = $db->prepare('UPDATE planning_tmp_dl set planning = ?'); + $req->execute(array($cal->GetICS())); + + header('Location: assets/scripts/planning_tmp.php'); } diff --git a/assets/scripts/planning_tmp.php b/assets/scripts/planning_tmp.php new file mode 100644 index 0000000..b595ec9 --- /dev/null +++ b/assets/scripts/planning_tmp.php @@ -0,0 +1,18 @@ + +query('SELECT planning FROM planning_tmp_dl'); +$r = $req -> fetchAll(PDO::FETCH_ASSOC); + +header('Content-Type: text/ics'); +header('Content-Transfer-Encoding: Binary'); +header('Content-Disposition:attachment; filename=planning_semaine_accueil.ics'); + +echo $r[0]['planning']; + +exit(); + +header('Location: ../../index.php'); + +?> \ No newline at end of file