mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-22 02:04:19 +00:00
Maxime Delorme suggested that we should do this differently now that
the iCalendar class is more functional. I agree.
This commit is contained in:
parent
a79967dfa8
commit
c2794db775
@ -45,6 +45,10 @@ else if ( $qry->rows > 1 ) {
|
||||
*/
|
||||
include_once("iCalendar.php");
|
||||
$response = iCalendar::iCalHeader();
|
||||
$collqry = new PgQuery( "SELECT * FROM collection WHERE collection.user_no = ? AND collection.dav_name = ?;", $request->user_no, $request->path);
|
||||
if ( $collqry->Exec("GET") && $collection = $collqry->Fetch() ) {
|
||||
$response .= "X-WR-CALNAME:$collection->dav_displayname\r\n";
|
||||
}
|
||||
$timezones = array();
|
||||
while( $event = $qry->Fetch() ) {
|
||||
$ical = new iCalendar( array( "icalendar" => $event->caldav_data ) );
|
||||
@ -63,7 +67,8 @@ else if ( $qry->rows > 1 ) {
|
||||
}
|
||||
elseif ( $c->hide_alarm ) {
|
||||
// Otherwise we hide the alarms (if configured to)
|
||||
$response .= $ical->Render( false, $event->caldav_type, $ical->DefaultPropertyList() );
|
||||
$ical->component->ClearComponents('VALARM');
|
||||
$response .= $ical->render(true, $event->caldav_type );
|
||||
}
|
||||
else {
|
||||
$response .= $ical->Render( false, $event->caldav_type );
|
||||
|
||||
@ -73,14 +73,15 @@ function calendar_to_xml( $properties, $item ) {
|
||||
if ( $item->class == 'CONFIDENTIAL' ) {
|
||||
// if the event is confidential we fake one that just says "Busy"
|
||||
$displayname = translate("Busy");
|
||||
$ical = new iCalendar( array( "icalendar" => $item->caldav_data) );
|
||||
$ical = new iCalendar( array( "icalendar" => $caldav_data) );
|
||||
$ical->Put( 'SUMMARY', $displayname );
|
||||
$caldav_data = $ical->render(true, $item->caldav_type, $ical->DefaultPropertyList() );
|
||||
$caldav_data = $ical->render(true, $caldav_type, $ical->DefaultPropertyList() );
|
||||
}
|
||||
elseif ( $c->hide_alarm ) {
|
||||
// Otherwise we hide the alarms (if configured to)
|
||||
$ical = new iCalendar( array( "icalendar" => $item->caldav_data) );
|
||||
$caldav_data = $ical->render(true, $item->caldav_type, $ical->DefaultPropertyList() );
|
||||
$ical = new iCalendar( array( "icalendar" => $caldav_data) );
|
||||
$ical->component->ClearComponents('VALARM');
|
||||
$caldav_data = $ical->render(true, $caldav_type );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,7 +91,7 @@ function calendar_to_xml( $properties, $item ) {
|
||||
foreach( $properties AS $k => $v ) {
|
||||
switch( $k ) {
|
||||
case 'GETCONTENTLENGTH':
|
||||
$contentlength = strlen($item->caldav_data);
|
||||
$contentlength = strlen($caldav_data);
|
||||
$prop->NewElement("getcontentlength", $contentlength );
|
||||
break;
|
||||
case 'CALENDAR-DATA':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user