mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-31 18:46:02 +00:00
Much better approach, using values we have already parsed on PUT, rather
than parsing all again.
This commit is contained in:
parent
d79cbae2d9
commit
4410d8b0e7
@ -4,14 +4,25 @@ require_once("iCalendar.php");
|
||||
|
||||
header("Content-type: text/plain");
|
||||
|
||||
$where .= " WHERE caldav_data.dav_name ~ ".qpg("^".$request_path)." ";
|
||||
$qry = new PgQuery( "SELECT * FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)". $where );
|
||||
$sql = "SELECT caldav_data.caldav_type AS type, calendar_item.uid, calendar_item.rrule ";
|
||||
$sql .= ", to_char(dtstart at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS dtstart ";
|
||||
$sql .= ", to_char(dtend at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS dtend ";
|
||||
$sql .= ", to_char(due at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS due ";
|
||||
$sql .= ", to_char(dtstamp,".iCalendar::SqlUTCFormat().") AS dtstamp ";
|
||||
$sql .= ", to_char(last_modified,".iCalendar::SqlUTCFormat().") AS \"last-modified\" ";
|
||||
$sql .= " FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)";
|
||||
$sql .= " WHERE caldav_data.dav_name ~ ".qpg("^".$request_path)." ";
|
||||
$qry = new PgQuery( $sql );
|
||||
|
||||
echo iCalendar::iCalHeader();
|
||||
|
||||
$freebusy_properties = array( "uid", "dtstamp", "dtstart", "duration", "last-modified", "rrule" );
|
||||
|
||||
if ( $qry->Exec("freebusy",__LINE__,__FILE__) && $qry->rows > 0 ) {
|
||||
echo iCalendar::iCalHeader();
|
||||
while( $calendar_object = $qry->Fetch() ) {
|
||||
$parsed = new iCalendar( array('icalendar' => $calendar_object->caldav_data ) );
|
||||
echo $parsed->RenderFreeBusy();
|
||||
while( $calendar_item = $qry->Fetch() ) {
|
||||
$event = new iCalendar( $calendar_item );
|
||||
echo $event->Render( false, 'VFREEBUSY', $freebusy_properties );
|
||||
}
|
||||
echo iCalendar::iCalFooter();
|
||||
}
|
||||
echo iCalendar::iCalFooter();
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user