From 1ef4ea28e109277632d842beb0068d26260f0d7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jan 2008 23:55:26 +0000 Subject: [PATCH] New: Ajout d'un lien export de l'agenda webcalendar au format ical et vcal --- htdocs/lib/xcal.lib.php | 8 +++++--- htdocs/webcal/webcal.class.php | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php index 40d3bcb62e5..cd04627b03d 100644 --- a/htdocs/lib/xcal.lib.php +++ b/htdocs/lib/xcal.lib.php @@ -28,12 +28,14 @@ /** \brief Build a file from an array of events \param format 'vcal' or 'ical' + \param title Title of export + \param desc Description of export \param events_array Array of events ('eid','startdate','duration','enddate','title','summary','category','email','url','desc','author') \param outputfile Output file \param filter Filter \return int <0 if ko, Nb of events in file if ok */ -function build_calfile($format='vcal',$events_array,$outputfile,$filter='') +function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile,$filter='') { dolibarr_syslog("xcal.lib.php::build_cal_file Build cal file ".$outputfile." to format ".$format); @@ -49,11 +51,11 @@ function build_calfile($format='vcal',$events_array,$outputfile,$filter='') fwrite($calfileh,"VERSION:2.0\n"); fwrite($calfileh,"METHOD:PUBLISH\n"); fwrite($calfileh,"PRODID:-//DOLIBARR ".DOL_VERSION."//EN\n"); + fwrite($calfileh,"X-WR-CALNAME: ".utf8_encode($title)."\n"); + fwrite($calfileh,"X-WR-CALDESC: ".utf8_encode($desc)."\n"); /* - X-WR-CALNAME:Agenda du Libre X-WR-TIMEZONE:Europe/Paris CALSCALE:GREGORIAN - X-WR-CALDESC:L'Agenda des évènements autour du Libre */ foreach ($events_array as $date => $event) diff --git a/htdocs/webcal/webcal.class.php b/htdocs/webcal/webcal.class.php index e98efc516e8..d7d605eaaa9 100644 --- a/htdocs/webcal/webcal.class.php +++ b/htdocs/webcal/webcal.class.php @@ -274,7 +274,9 @@ class Webcal { } // Write file - $result=build_calfile($format,$eventarray,$outputfile); + $title='Webcalendar events '; + $desc='Webcalendar events for database '.$this->localdb->database_name.' - generated by Dolibarr'; + $result=build_calfile($format,$title,$desc,$eventarray,$outputfile); } return $result;