ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarExport Class Reference

Export calendar(s) to ical format More...

+ Collaboration diagram for ilCalendarExport:

Public Member Functions

 __construct ($a_calendar_ids)
 export ()
 getExportString ()

Protected Member Functions

 addTimezone ()
 addCategories ()
 createVTODO ($app)
 createVEVENT ($app)
 createRecurrences ($app)
 buildAppointmentUrl (ilCalendarEntry $entry)
 Build url from calendar entry.

Protected Attributes

 $calendars = array()
 $writer = null

Detailed Description

Export calendar(s) to ical format

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 36 of file class.ilCalendarExport.php.

Constructor & Destructor Documentation

ilCalendarExport::__construct (   $a_calendar_ids)

Definition at line 41 of file class.ilCalendarExport.php.

{
$this->calendars = $a_calendar_ids;
$this->writer = new ilICalWriter();
}

Member Function Documentation

ilCalendarExport::addCategories ( )
protected

Definition at line 64 of file class.ilCalendarExport.php.

References ilCalendarCategoryAssignments\_getAssignedAppointments(), ilCalendarCategories\_getInstance(), createVEVENT(), and createVTODO().

Referenced by export().

{
foreach($this->calendars as $category_id)
{
ilCalendarCategories::_getInstance()->getSubitemCategories($category_id)
) as $app_id)
{
$app = new ilCalendarEntry($app_id);
if($app->isMilestone())
{
$this->createVTODO($app);
}
else
{
$this->createVEVENT($app);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarExport::addTimezone ( )
protected

Definition at line 59 of file class.ilCalendarExport.php.

Referenced by export().

{
// TODO
}

+ Here is the caller graph for this function:

ilCalendarExport::buildAppointmentUrl ( ilCalendarEntry  $entry)
protected

Build url from calendar entry.

Parameters
ilCalendarEntry$entry
Returns
string

Definition at line 168 of file class.ilCalendarExport.php.

References ilObject\_getAllReferences(), ilLink\_getLink(), ilCalendarCategoryAssignments\_lookupCategories(), ilCalendarEntry\getEntryId(), ilCalendarCategory\getInstanceByCategoryId(), and ilCalendarCategory\TYPE_OBJ.

Referenced by createVEVENT().

{
);
if($cat->getType() != ilCalendarCategory::TYPE_OBJ)
{
$this->writer->addLine('URL;VALUE=URI:'.ILIAS_HTTP_PATH);
}
else
{
$refs = ilObject::_getAllReferences($cat->getObjId());
include_once './classes/class.ilLink.php';
$this->writer->addLine(
'URL;VALUE=URI:'.ilLink::_getLink(current((array) $refs))
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarExport::createRecurrences (   $app)
protected

Definition at line 144 of file class.ilCalendarExport.php.

References ilCalendarRecurrences\_getRecurrences(), and ilCalendarRecurrenceExclusions\getExclusionDates().

Referenced by createVEVENT().

{
include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php';
foreach(ilCalendarRecurrences::_getRecurrences($app->getEntryId()) as $rec)
{
foreach(ilCalendarRecurrenceExclusions::getExclusionDates($app->getEntryId()) as $excl)
{
$this->writer->addLine($excl->toICal());
}
$this->writer->addLine($rec->toICal());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarExport::createVEVENT (   $app)
protected

Definition at line 91 of file class.ilCalendarExport.php.

References buildAppointmentUrl(), createRecurrences(), ilICalWriter\escapeText(), IL_CAL_DAY, and IL_CAL_FKT_DATE.

Referenced by addCategories().

{
global $ilUser;
$this->writer->addLine('BEGIN:VEVENT');
// TODO only domain
$this->writer->addLine('UID:'.ilICalWriter::escapeText(
$app->getEntryId().'_'.CLIENT_ID.'@'.ILIAS_HTTP_PATH));
#$last_mod = $app->getLastUpdate()->get(IL_CAL_FKT_DATE,'Ymd\THis\Z',ilTimeZone::UTC);
$last_mod = $app->getLastUpdate()->get(IL_CAL_FKT_DATE,'Ymd\THis\Z',$ilUser->getTimeZone());
$this->writer->addLine('LAST-MODIFIED:'.$last_mod);
if($app->isFullday())
{
// According to RFC 5545 3.6.1 DTEND is not inklusive.
// But ILIAS stores inklusive dates in the database.
$app->getEnd()->increment(IL_CAL_DAY,1);
#$start = $app->getStart()->get(IL_CAL_FKT_DATE,'Ymd\Z',ilTimeZone::UTC);
$start = $app->getStart()->get(IL_CAL_FKT_DATE,'Ymd',$ilUser->getTimeZone());
#$end = $app->getEnd()->get(IL_CAL_FKT_DATE,'Ymd\Z',ilTimeZone::UTC);
$end = $app->getEnd()->get(IL_CAL_FKT_DATE,'Ymd',$ilUser->getTimeZone());
$this->writer->addLine('DTSTART;VALUE=DATE:' . $start);
$this->writer->addLine('DTEND;VALUE=DATE:'.$end);
}
else
{
#$start = $app->getStart()->get(IL_CAL_FKT_DATE,'Ymd\THis\Z',ilTimeZone::UTC);
$start = $app->getStart()->get(IL_CAL_FKT_DATE,'Ymd\THis',$ilUser->getTimeZone());
#$end = $app->getEnd()->get(IL_CAL_FKT_DATE,'Ymd\THis\Z',ilTimeZone::UTC);
$end = $app->getEnd()->get(IL_CAL_FKT_DATE,'Ymd\THis',$ilUser->getTimeZone());
$this->writer->addLine('DTSTART;TZID='.$ilUser->getTimezone().':'. $start);
$this->writer->addLine('DTEND;TZID='.$ilUser->getTimezone().':'.$end);
}
$this->createRecurrences($app);
$this->writer->addLine('SUMMARY:'.ilICalWriter::escapeText($app->getPresentationTitle()));
if(strlen($app->getDescription()))
$this->writer->addLine('DESCRIPTION:'.ilICalWriter::escapeText($app->getDescription()));
if(strlen($app->getLocation()))
$this->writer->addLine('LOCATION:'.ilICalWriter::escapeText($app->getLocation()));
// TODO: URL
$this->buildAppointmentUrl($app);
$this->writer->addLine('END:VEVENT');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarExport::createVTODO (   $app)
protected

Definition at line 85 of file class.ilCalendarExport.php.

Referenced by addCategories().

{
// TODO
return true;
}

+ Here is the caller graph for this function:

ilCalendarExport::export ( )

Definition at line 47 of file class.ilCalendarExport.php.

References addCategories(), and addTimezone().

Referenced by ilCalendarRemoteAccessHandler\handleRequest().

{
$this->writer->addLine('BEGIN:VCALENDAR');
$this->writer->addLine('VERSION:2.0');
$this->writer->addLine('PRODID:-//ilias.de/NONSGML ILIAS Calendar V4.1//EN');
$this->addTimezone();
$this->addCategories();
$this->writer->addLine('END:VCALENDAR');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarExport::getExportString ( )

Definition at line 158 of file class.ilCalendarExport.php.

{
return $this->writer->__toString();
}

Field Documentation

ilCalendarExport::$calendars = array()
protected

Definition at line 38 of file class.ilCalendarExport.php.

ilCalendarExport::$writer = null
protected

Definition at line 39 of file class.ilCalendarExport.php.


The documentation for this class was generated from the following file: