dolibarr 24.0.0-beta
xcal.lib.php File Reference

Function to manage calendar files (vcal/ical/...) More...

Go to the source code of this file.

Functions

 build_calfile ($format, $title, $desc, $events_array, $outputfile)
 Build a file from an array of events All input params and data must be encoded in $conf->charset_output.
 
 build_rssfile ($format, $title, $desc, $events_array, $outputfile, $filter='', $url='', $langcode='', $useurlforguid=false)
 Build a file from an array of events.
 
 format_cal ($format, $string)
 Encode for cal export.
 
 calEncode ($line)
 Cut string after 75 chars.
 
 quotedPrintEncode ($str, $forcal=0)
 Encode into vcal format.
 
 quotedPrintDecode ($str)
 Decode vcal format.
 

Detailed Description

Function to manage calendar files (vcal/ical/...)

Definition in file xcal.lib.php.

Function Documentation

◆ build_calfile()

build_calfile ( $format,
$title,
$desc,
$events_array,
$outputfile )

Build a file from an array of events All input params and data must be encoded in $conf->charset_output.

Parameters
string$format"vcal" or "ical"
string$titleTitle of export
string$descDescription of export
array<string,WebsitePage|array{uid:string,startdate:int,summary:string,desc:string,url?:?string,author:string,category?:?string,image?:?string,content?:?string}>$events_array Array of events ("uid","startdate","summary","url","desc","author","category","image") or Array of WebsitePage
string$outputfileOutput file
Returns
int Return integer < 0 if KO, Nb of events in file if OK

Definition at line 36 of file xcal.lib.php.

References convertSecondToTime(), dol_now(), dol_print_date(), dol_string_nohtmltag(), dol_syslog(), dol_time_plus_duree(), dolChmod(), format_cal(), getDolGlobalInt(), and getDolGlobalString().

Referenced by ActionComm\build_exportfile().

◆ build_rssfile()

build_rssfile ( $format,
$title,
$desc,
$events_array,
$outputfile,
$filter = '',
$url = '',
$langcode = '',
$useurlforguid = false )

Build a file from an array of events.

All input data must be encoded in $conf->charset_output

Parameters
string$format"rss"
string$titleTitle of export
string$descDescription of export
array<WebsitePage|array{uid:string,startdate:int,summary:string,desc:string,url?:?string,author:string,category?:?string,image?:?string,content?:?string}>$events_array Array of events ("uid","startdate","summary","url","desc","author","category","image") or Array of WebsitePage
string$outputfileOutput file
string$filter(optional) Filter
string$urlUrl (If empty, forge URL for agenda RSS export)
string$langcodeLanguage code to show in header
bool$useurlforguidIf true, use URL as guid, else use uid as guid. Using URL as guid is better for RSS reader to detect changes of event, but it can cause problem if URL is not stable (for example if it contains a session id or a token that can change).
Returns
int Return integer < 0 if KO, Nb of events in file if OK

Definition at line 325 of file xcal.lib.php.

References $dolibarr_main_url_root, $mysoc, date, dol_escape_xml(), dol_string_nohtmltag(), dol_syslog(), dolChmod(), getDolGlobalString(), getImageFromHtmlContent(), getRootURLFromURL(), and string.

Referenced by ActionComm\build_exportfile().

◆ calEncode()

calEncode ( $line)

Cut string after 75 chars.

Add CRLF+Space. line must be encoded in UTF-8

Parameters
string$lineString to convert
Returns
string String converted

Definition at line 535 of file xcal.lib.php.

References dol_strlen(), and dol_substr().

Referenced by format_cal().

◆ format_cal()

format_cal ( $format,
$string )

Encode for cal export.

Parameters
string$format"vcal" or "ical"
string$stringString to encode
Returns
string String encoded

Definition at line 507 of file xcal.lib.php.

References calEncode(), and quotedPrintEncode().

Referenced by build_calfile().

◆ quotedPrintDecode()

quotedPrintDecode ( $str)

Decode vcal format.

Parameters
string$strString to convert
Returns
string String converted

Definition at line 636 of file xcal.lib.php.

Referenced by ICal\parse().

◆ quotedPrintEncode()

quotedPrintEncode ( $str,
$forcal = 0 )

Encode into vcal format.

Parameters
string$strString to convert
int$forcal(optional) 1 = For cal
Returns
string String converted

Definition at line 590 of file xcal.lib.php.

Referenced by format_cal().