From b35736399849df94bde4e01ca326ba3522d8acc0 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 12 Sep 2017 18:38:46 +0200 Subject: [PATCH] Managing unavailable ics in interface + updated does not append the first time (to replace last content) --- build/router/controller/page.php | 7 ++++++- build/service/Updater.php | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build/router/controller/page.php b/build/router/controller/page.php index 026c9fc..778ec1b 100644 --- a/build/router/controller/page.php +++ b/build/router/controller/page.php @@ -45,7 +45,12 @@ /* [2] Display the links =========================================================*/ foreach($diplomes as $id=>$name){ - echo "$name
"; + + + if( !file_exists(__ROOT__."/tmp/$id.ics") ) + echo "$name
"; + else + echo "$name
"; } diff --git a/build/service/Updater.php b/build/service/Updater.php index c4367be..58fca82 100644 --- a/build/service/Updater.php +++ b/build/service/Updater.php @@ -43,7 +43,7 @@ =========================================================*/ foreach($this->config->getDiplomes() as $d_id=>$d_name){ - file_put_contents(__ROOT__."/tmp/$d_id.ics", "BEGIN:VCALENDAR\nVERSION:2.0\n", FILE_APPEND); + file_put_contents(__ROOT__."/tmp/$d_id.ics", "BEGIN:VCALENDAR\nVERSION:2.0\n"); /* (1) Browse each date ---------------------------------------------------------*/ @@ -61,8 +61,6 @@ /* (4) Add to file */ file_put_contents(__ROOT__."/tmp/$d_id.ics", $EVENTS, FILE_APPEND); - - } file_put_contents(__ROOT__."/tmp/$d_id.ics", "END:VCALENDAR", FILE_APPEND);