bocalupdate_vfreebusy Class Reference

Inheritance diagram for bocalupdate_vfreebusy:

egwical_resourcehandler Collaboration diagram for bocalupdate_vfreebusy:

Collaboration graph
[legend]
List of all members.

Detailed Description

Concrete subclass resourcehandler for iCal vfreebusy import and export with a egroupware bocalupdate calendar resource.

Synopsis

A simple export of a freebusy calendar example. First we need a couple of egw events, a request period, for which we want to know the freebusy times and an instance of our vfreebusy calendarresource handler class:
  $boc =& CreateObject('calendar.bocalupdate');

  $ev1 = $boc->read(1233);                    // get two events
  $ev2 = $boc->read(4011);

  $fbreq = array('url'=> '/myfreebusy.vfb',
                 'start' => '20060201',
                 'end'   => '20061231'
                 );
  $devicetype = 'all';               
  $calhnd =& CreateObject( 'egwical.bocalupdate_vfreebusy',
                           $boc,
                           $devicetype,
                           $fbreq );

Now export all the freebusy times from the two events as a VFREEBUSY element and render it as iCalendar string
   // alternative 1
   $events = array($ev1, $ev2);
   $vfreebusies =& $calhnd->export_velts($events);
   if($vfreebusies === false) exit;

   $vcalstr1 = egwical_resourcehandler::render_velt2vcal($vfreebusies);
In the current implementation all the freebusy times are collected and added to a single VFREEBUSY element as FBTYPE field, so the name $vfreebusies in the example may be a bit misleading.

Todo:
Here should come some more text about the workings of this class especially about how this class ovewrites some extra methods of the baseclass egwical-resourcehandler, because in the vfreebusy multiple events are converted into a single vfreebusy element.

get import of freebusy working.... Inpackage: egwical

Author:
Jan van Lieshout <jvl-AT-xs4all.nl> (This version. new api rewrite, refactoring, and extension).
Version:
0.9.36-a1 first version for NAPI-3.1
Date:
20060410
Version:
0.9.30a1 first version for napi3 license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License


Public Member Functions

 bocalupdate_vfreebusy (egwobj $egwrsc=null, ProductType $devicetype='all', string $rscownid, array &$fb_req=null)
 Our Constructor, if given it sets the egw resource $egwrsc is set as so called bound egw resource.
VcalStr export_vcal (array_of_EventId-I-array_of_EventData &$eids, array $attribs=null)
 Export events from bocal as vfreebusy iCalendar string.
VFREEBUSY export_velts (array_of_EventId-I-array_of_EventData &$eids)
 Export all events as a VFREEBUSY element --overwrites baseclass method--.
VFREEBUSY I false export_vfreebusy (&$events)
 Export calendar events from bound bocalupdate resource as FREEBUSY field.
VFREEBUSY I False import_vfreebusy (&$vfreebusy)
 Import a VFREEBUSY element, i.e.
boolean set_rsc (egwobj $egw_rsc)
 Set the egw calendar resource that this worker will handle.
void setSupportedFields (ProductType $devicetype= 'all')
 Set the list of ical fields that are supported during the next imports and exports.

Public Attributes

array $fb_req = array()
 Request Info hash - some of the fields from the request This is to be set by the constructor of this handler.

Private Member Functions

array _provided_vfreebusy2eventFields ()
 Deliver the implemented vfreebusy to event mapping as provided by this class.

Private Attributes

bocalupdate $rsc = null
 The Bound Egw Resource that we handle.
boolean $vfdebug = false
 Switch to print extra debugging about imported and exported elements to the httpd errorlog stream.
array $vfreebusy2eventFields = array()
 mapping from iCalendar VFREEBUSY fields to egw calendar fields


Constructor & Destructor Documentation

bocalupdate_vfreebusy::bocalupdate_vfreebusy egwobj $  egwrsc = null,
ProductType $  devicetype = 'all',
string $  rscownid,
array &$  fb_req = null
 

Our Constructor, if given it sets the egw resource $egwrsc is set as so called bound egw resource.

And $prodid, the product id of the client that will use or produce ical data is set to determine which fields to use in coming import and exportd conversions between vcalendar and egw data.

Parameters:
$egwrsc Egroupware data resource object that will be used to transport (i.e. import and export) the vfreebusy elements from. This can also later be set using the set_rsc() method.
$devicetype The type identification of the device that is used to
$rscownid the id of the calendar owner. This is only needed for import in calendars not owned by the authenticated user. Default (0) the id of the authenticated user is used.
$fb_req hash with e.g. start, end and requestor for the freebusy request. See also fb_req


Member Function Documentation

array bocalupdate_vfreebusy::_provided_vfreebusy2eventFields  )  [private]
 

Deliver the implemented vfreebusy to event mapping as provided by this class.

Produce the array of vfreebusy to event field mappings that this class implements. These are stored on instantiation in the variable $vfreebusy2eventFields

Note:
this is just a vague indication of fields handled...
Returns:
The provided vfreebusy to event fields mapping.

VcalStr bocalupdate_vfreebusy::export_vcal array_of_EventId-I-array_of_EventData &$  eids,
array $  attribs = null
 

Export events from bocal as vfreebusy iCalendar string.

--overwrites base method--

All the egw elements in the bound egw bocalendar resource, refered to by the ids in $eids are exported as Vfreebusy Vcalendar formatted string. Specific global attributes settings for this string are taken from .....

Parameters:
$eids a list of events ids or arraydata for the bound calendar resource whose freebusy time are to be exported.
$attribs optional hash with global iCalendar attributes settings. These attributes will be added and possibly override the standard attributes as found in $this->vcalendar2egwAttributes
Returns:
a iCalendar formatted string corresponding to the VFREEBUSY data converted from the egw events refered to by $eids On error: false

VFREEBUSY bocalupdate_vfreebusy::export_velts array_of_EventId-I-array_of_EventData &$  eids  ) 
 

Export all events as a VFREEBUSY element --overwrites baseclass method--.

Parameters:
$eids list of event id in the bound bocalupdate resource that are to be exported in VFREEBUSY elements.
Returns:
the exported egw events converted to one or more VFREEBUSY objects. on error False.

VFREEBUSY I false bocalupdate_vfreebusy::export_vfreebusy &$  events  ) 
 

Export calendar events from bound bocalupdate resource as FREEBUSY field.

The eGW events in $eids are exported to a iCalendar FREEBUSY (of type Horde_iCalendar_vfreebusyd). For each event a FREEBUSY field is set. Note that only the set of supported Fields, as indicated by the $supportedFields member variable, are considered for the VFREEBUSY.

The end and start of the freebusy period are set from the member variables $fb_start and $fb-end.

Todo:
should the VFREEBUSY element get a uid? and if so: what and why?
Bug:
export_vfreebusy is currently very rudimentary....
Parameters:
$eids list of the eGW events by id or as arraydata, whose freebusy times will be exported.
Returns:
an iCalendar VFREEBUSY object that collects all the freebusy times from the events in $eids. With a period set according the $fb_start and $fb_end member vars. On error: false

VFREEBUSY I False bocalupdate_vfreebusy::import_vfreebusy &$  vfreebusy  ) 
 

Import a VFREEBUSY element, i.e.

: respond to the freebusy request-periods with an exported VFREEBUSY element.

The ical VFREEBUSY component is converted to an set of dtstart, dtend pairs. On the calendar resource in $rsc is then and export_vfreebusy() done for these periods and this is return as result.

$supportedFields determines the VFREEBUSY fields that will be used considered

Todo:
this needs to be implemented ....
Parameters:
$vfbelt VFREEBUSY object (horde_iCalendar_vfreebusy) with a requestperiods for freebusy info from our bocalupdate resource in $rsc
Returns:
an vfreebusy element that delivers freebusy settings for the requested periods in the $vfbelt argument. On error: False

boolean bocalupdate_vfreebusy::set_rsc egwobj $  egw_rsc  ) 
 

Set the egw calendar resource that this worker will handle.

This worker is only capable of handling bocalupdate calendar objects, so it should be of that class. The $egw_rsc is registered in the $rsc variable and the supported ical element is set to be 'vevent'. This is registered in $rsc_vtypes.

Parameters:
$egw_rsc the resource object of type bocalupdate that will be used to transport the ical data to and from.
Returns:
false on error, true if the $egw_rsc was indeed a correct resource of the supported type (bocalupdate).

void bocalupdate_vfreebusy::setSupportedFields ProductType $  devicetype = 'all'  ) 
 

Set the list of ical fields that are supported during the next imports and exports.

The list of iCal fields that should be converted during the following imports and exports of VFREEBUSY s is set. This is done according to a given ProductType as mostly set in the $deviceType field of the egwical_resourcehandler. See there for a further description.

In a small lookup table the set of currently supported fields is searched for and then and then these are set accordingly in the class member $supportedFields.

Todo:
review this code to cater for vfreebusy usage!!
Note:
to find the ProductType for a device (like a iCalendar, browser, a syncml client etc.) the egwical_resoucehandler class provides some handy methods, like: icalendarProdId2devicetype(), httpUserAgent2deviceType() and product2devicetype()
Parameters:
$devicetype a string indicating the communicating client his type of device
Returns:


Member Data Documentation

array bocalupdate_vfreebusy::$fb_req = array()
 

Request Info hash - some of the fields from the request This is to be set by the constructor of this handler.

Fields that can be set in this hash are:

 $fb_req = array('start'     => <Start time of the request period for the freebusies>, 
                 'end'       => <End time of the request period for the freebusies>,
                 'requestor' => <Requestor of the freebusy output (by egw id)>,
                 'cal_owner' => <Owner of the calendar (by egw id)>,
                 );

bocalupdate bocalupdate_vfreebusy::$rsc = null [private]
 

The Bound Egw Resource that we handle.

Registry for the egw resource object (calendar, infolog,..) that will be used to transport ical elements from and to: The socalled Bound Resource This can be set by the constructor or later by set_rsc().

Reimplemented from egwical_resourcehandler.

boolean bocalupdate_vfreebusy::$vfdebug = false [private]
 

Switch to print extra debugging about imported and exported elements to the httpd errorlog stream.

array bocalupdate_vfreebusy::$vfreebusy2eventFields = array() [private]
 

mapping from iCalendar VFREEBUSY fields to egw calendar fields

An array containing roughly the mapping from iCalendar to egw fields. Set by constructor. example entry (rn stands for "Resourced_Name"):

	'SUMMARY'	=> array('rn' => 'title'),
Here rn stands for "Resourced Name", to indicate the name of the related related field in the bound egw resource
Todo:
integrate this with the egwical base $ical2egw conversion table


The documentation for this class was generated from the following file:
Generated on Thu Jun 8 21:57:23 2006 for EgwIcal by  doxygen 1.4.6