ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarRemoteReader Class Reference

Reader for remote ical calendars. More...

+ Collaboration diagram for ilCalendarRemoteReader:

Public Member Functions

 __construct ($a_url)
 Constructor init curl.
 setUser ($a_user)
 setPass ($a_pass)
 getType ()
 getUrl ()
 read ()
 Read ical format.
 import (ilCalendarCategory $cat)
 Import appointments in calendar.

Data Fields

const TYPE_ICAL = 1

Protected Member Functions

 readIcal ()
 Read ical.
 importIcal (ilCalendarCategory $cat)
 Import ical in calendar.
 initCurl ()
 Init curl connection.
 replaceWebCalProtocol ()

Private Member Functions

 call ()
 call peer

Private Attributes

 $type = self::TYPE_ICAL
 $curl = null
 $url
 $user
 $pass
 $ical

Detailed Description

Reader for remote ical calendars.

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

Definition at line 14 of file class.ilCalendarRemoteReader.php.

Constructor & Destructor Documentation

ilCalendarRemoteReader::__construct (   $a_url)

Constructor init curl.

Definition at line 35 of file class.ilCalendarRemoteReader.php.

{
$this->url = $a_url;
}

Member Function Documentation

ilCalendarRemoteReader::call ( )
private

call peer

private

Exceptions
ilCurlConnectionException

Definition at line 170 of file class.ilCalendarRemoteReader.php.

References $res.

Referenced by readIcal().

{
try
{
$res = $this->curl->exec();
return $res;
}
{
throw($exc);
}
}

+ Here is the caller graph for this function:

ilCalendarRemoteReader::getType ( )

Definition at line 50 of file class.ilCalendarRemoteReader.php.

References $type.

Referenced by import(), and read().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilCalendarRemoteReader::getUrl ( )

Definition at line 55 of file class.ilCalendarRemoteReader.php.

References $url.

Referenced by initCurl(), and replaceWebCalProtocol().

{
return $this->url;
}

+ Here is the caller graph for this function:

ilCalendarRemoteReader::import ( ilCalendarCategory  $cat)

Import appointments in calendar.

Returns
type

Definition at line 81 of file class.ilCalendarRemoteReader.php.

References getType(), and importIcal().

{
switch($this->getType())
{
case self::TYPE_ICAL:
return $this->importIcal($cat);
}
}

+ Here is the call graph for this function:

ilCalendarRemoteReader::importIcal ( ilCalendarCategory  $cat)
protected

Import ical in calendar.

Parameters
ilCalendarCategory$cat

Definition at line 106 of file class.ilCalendarRemoteReader.php.

References ilCalendarEntry\_delete(), ilCalendarCategoryAssignments\_deleteByCategoryId(), ilCalendarCategoryAssignments\_getAssignedAppointments(), ilCalendarCategory\getCategoryID(), and ilICalParser\INPUT_STRING.

Referenced by import().

{
// Delete old appointments
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
{
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
}
// Import new appointments
include_once './Services/Calendar/classes/iCal/class.ilICalParser.php';
$parser = new ilICalParser($this->ical, ilICalParser::INPUT_STRING);
$parser->setCategoryId($cat->getCategoryID());
$parser->parse();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarRemoteReader::initCurl ( )
protected

Init curl connection.

Definition at line 127 of file class.ilCalendarRemoteReader.php.

References getUrl(), and replaceWebCalProtocol().

Referenced by read().

{
try {
$this->curl = new ilCurlConnection($this->getUrl());
$this->curl->init();
$this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
$this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
$this->curl->setOpt(CURLOPT_RETURNTRANSFER, 1);
$this->curl->setOpt(CURLOPT_FOLLOWLOCATION, 1);
$this->curl->setOpt(CURLOPT_MAXREDIRS, 3);
if($this->user)
{
$this->curl->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$this->curl->setOpt(CURLOPT_USERPWD,$this->user.':'.$this->pass);
}
}
catch(Exception $e)
{
throw $e;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarRemoteReader::read ( )

Read ical format.

Exceptions
sonething

Definition at line 66 of file class.ilCalendarRemoteReader.php.

References getType(), initCurl(), and readIcal().

{
$this->initCurl();
switch($this->getType())
{
case self::TYPE_ICAL:
return $this->readIcal();
}
}

+ Here is the call graph for this function:

ilCalendarRemoteReader::readIcal ( )
protected

Read ical.

Exceptions
ilCurlConnectionException

Definition at line 95 of file class.ilCalendarRemoteReader.php.

References $GLOBALS, and call().

Referenced by read().

{
$this->ical = $this->call();
$GLOBALS['ilLog']->write(__METHOD__.': '.$this->ical);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarRemoteReader::replaceWebCalProtocol ( )
protected

Definition at line 154 of file class.ilCalendarRemoteReader.php.

References $GLOBALS, and getUrl().

Referenced by initCurl().

{
if(substr($this->getUrl(), 0, 6) == 'webcal')
{
$purged = preg_replace('/webcal/', 'http', $this->getUrl(), 1);
$this->url = $purged;
$GLOBALS['ilLog']->write(__METHOD__.': Using new url: '. $this->getUrl());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarRemoteReader::setPass (   $a_pass)

Definition at line 45 of file class.ilCalendarRemoteReader.php.

{
$this->pass = $a_pass;
}
ilCalendarRemoteReader::setUser (   $a_user)

Definition at line 40 of file class.ilCalendarRemoteReader.php.

Referenced by ilCalendarCategoryGUI\doSynchronisation(), and ilCalendarPresentationGUI\synchroniseExternalCalendars().

{
$this->user = $a_user;
}

+ Here is the caller graph for this function:

Field Documentation

ilCalendarRemoteReader::$curl = null
private

Definition at line 22 of file class.ilCalendarRemoteReader.php.

ilCalendarRemoteReader::$ical
private

Definition at line 28 of file class.ilCalendarRemoteReader.php.

ilCalendarRemoteReader::$pass
private

Definition at line 26 of file class.ilCalendarRemoteReader.php.

ilCalendarRemoteReader::$type = self::TYPE_ICAL
private

Definition at line 20 of file class.ilCalendarRemoteReader.php.

Referenced by getType().

ilCalendarRemoteReader::$url
private

Definition at line 24 of file class.ilCalendarRemoteReader.php.

Referenced by getUrl().

ilCalendarRemoteReader::$user
private

Definition at line 25 of file class.ilCalendarRemoteReader.php.

const ilCalendarRemoteReader::TYPE_ICAL = 1

Definition at line 17 of file class.ilCalendarRemoteReader.php.


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