Managing unavailable ics in interface + updated does not append the first time (to replace last content)

This commit is contained in:
xdrm-brackets 2017-09-12 18:38:46 +02:00
parent 98c518eac6
commit b357363998
2 changed files with 7 additions and 4 deletions

View File

@ -45,7 +45,12 @@
/* [2] Display the links /* [2] Display the links
=========================================================*/ =========================================================*/
foreach($diplomes as $id=>$name){ foreach($diplomes as $id=>$name){
echo "<a href='/ics/$id'>$name</a><br>";
if( !file_exists(__ROOT__."/tmp/$id.ics") )
echo "<span>$name</span><br>";
else
echo "<a href='/ics/$id' disabled>$name</a><br>";
} }

View File

@ -43,7 +43,7 @@
=========================================================*/ =========================================================*/
foreach($this->config->getDiplomes() as $d_id=>$d_name){ 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 /* (1) Browse each date
---------------------------------------------------------*/ ---------------------------------------------------------*/
@ -61,8 +61,6 @@
/* (4) Add to file */ /* (4) Add to file */
file_put_contents(__ROOT__."/tmp/$d_id.ics", $EVENTS, FILE_APPEND); file_put_contents(__ROOT__."/tmp/$d_id.ics", $EVENTS, FILE_APPEND);
} }
file_put_contents(__ROOT__."/tmp/$d_id.ics", "END:VCALENDAR", FILE_APPEND); file_put_contents(__ROOT__."/tmp/$d_id.ics", "END:VCALENDAR", FILE_APPEND);