From c675349ded7f76549bbf400605989301cea95618 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 24 Feb 2012 11:18:51 +1300 Subject: [PATCH] Add a command-line script to export a single calendar to stdout. --- scripts/export_calendar.php | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 scripts/export_calendar.php diff --git a/scripts/export_calendar.php b/scripts/export_calendar.php new file mode 100755 index 00000000..fd2abed3 --- /dev/null +++ b/scripts/export_calendar.php @@ -0,0 +1,78 @@ +#!/usr/bin/env php +user_no = -1; + $this->principal_id = -1; + $this->logged_in = false; + return; + } + + $this->user_no = $user_no; + $principal = new Principal('user_no',$user_no); + // Assign each field in the selected record to the object + foreach( $principal AS $k => $v ) { + $this->{$k} = $v; + } + $this->username = $principal->username(); + $this->principal_id = $principal->principal_id(); + $this->email = $principal->email(); + $this->dav_name = $principal->dav_name(); + $this->principal = $principal; + + $this->logged_in = true; + + } + + function AllowedTo($do_something) { + return $this->logged_in; + } +} +$session = new FakeSession(); + +require("caldav-GET-functions.php"); +$calendar = new DAVResource($source); + +echo export_iCalendar($calendar); +