ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCalendarRemoteReader Class Reference

Reader for remote ical calendars. More...

+ Collaboration diagram for ilCalendarRemoteReader:

Public Member Functions

 __construct (string $a_url)
 
 setUser (string $a_user)
 
 setPass (string $a_pass)
 
 getType ()
 
 getUrl ()
 
 read ()
 
 import (ilCalendarCategory $cat)
 

Protected Member Functions

 readIcal ()
 
 importIcal (ilCalendarCategory $cat)
 
 initCurl ()
 
 replaceWebCalProtocol ()
 

Protected Attributes

const TYPE_ICAL = 1
 

Private Member Functions

 call ()
 

Private Attributes

int $type = self::TYPE_ICAL
 
ilCurlConnection $curl = null
 
string $url = ''
 
string $user = ''
 
string $pass = ''
 
string $ical = ''
 
ilLogger $logger
 

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 26 of file class.ilCalendarRemoteReader.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRemoteReader::__construct ( string  $a_url)

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

43 {
44 global $DIC;
45
46 $this->logger = $DIC->logger()->cal();
47 $this->url = $a_url;
48 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ call()

ilCalendarRemoteReader::call ( )
private
Exceptions
ilCurlConnectionException

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

148 : string
149 {
150 try {
151 return $this->curl->exec();
152 } catch (ilCurlConnectionException $exc) {
153 throw($exc);
154 }
155 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by readIcal().

+ Here is the caller graph for this function:

◆ getType()

ilCalendarRemoteReader::getType ( )

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

60 : int
61 {
62 return $this->type;
63 }

References $type.

Referenced by import(), and read().

+ Here is the caller graph for this function:

◆ getUrl()

ilCalendarRemoteReader::getUrl ( )

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

65 : string
66 {
67 return $this->url;
68 }

References $url.

Referenced by initCurl(), and replaceWebCalProtocol().

+ Here is the caller graph for this function:

◆ import()

ilCalendarRemoteReader::import ( ilCalendarCategory  $cat)

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

81 : void
82 {
83 switch ($this->getType()) {
84 case self::TYPE_ICAL:
85 $this->importIcal($cat);
86 break;
87 }
88 }
importIcal(ilCalendarCategory $cat)

References getType(), importIcal(), and TYPE_ICAL.

+ Here is the call graph for this function:

◆ importIcal()

ilCalendarRemoteReader::importIcal ( ilCalendarCategory  $cat)
protected

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

96 : void
97 {
98 // Delete old appointments
101 }
103
104 // Import new appointments
105 $parser = new ilICalParser($this->ical, ilICalParser::INPUT_STRING);
106 $parser->setCategoryId($cat->getCategoryID());
107 $parser->parse();
108 }
static _deleteByCategoryId(int $a_cat_id)
Delete assignments by category id @access public.
static _getAssignedAppointments(array $a_cat_id)
Get assigned apointments.
static _delete(int $a_entry_id)

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

Referenced by import().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCurl()

ilCalendarRemoteReader::initCurl ( )
protected
Exceptions
ilCurlConnectionException

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

113 : void
114 {
115 try {
116 $this->replaceWebCalProtocol();
117
118 $this->curl = new ilCurlConnection($this->getUrl());
119 $this->curl->init();
120
121 $this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
122 $this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
123 $this->curl->setOpt(CURLOPT_RETURNTRANSFER, 1);
124
125 $this->curl->setOpt(CURLOPT_FOLLOWLOCATION, 1);
126 $this->curl->setOpt(CURLOPT_MAXREDIRS, 3);
127
128 if ($this->user) {
129 $this->curl->setOpt(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
130 $this->curl->setOpt(CURLOPT_USERPWD, $this->user . ':' . $this->pass);
131 }
132 } catch (Exception $e) {
133 throw $e;
134 }
135 }

References Vendor\Package\$e, getUrl(), replaceWebCalProtocol(), and ILIAS\Repository\user().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilCalendarRemoteReader::read ( )

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

70 : void
71 {
72 $this->initCurl();
73
74 switch ($this->getType()) {
75 case self::TYPE_ICAL:
76 $this->readIcal();
77 break;
78 }
79 }

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

+ Here is the call graph for this function:

◆ readIcal()

ilCalendarRemoteReader::readIcal ( )
protected

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

90 : void
91 {
92 $this->ical = $this->call();
93 $this->logger->debug($this->ical);
94 }

References call(), and ILIAS\Repository\logger().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replaceWebCalProtocol()

ilCalendarRemoteReader::replaceWebCalProtocol ( )
protected

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

137 : void
138 {
139 if (substr($this->getUrl(), 0, 6) == 'webcal') {
140 $purged = preg_replace('/webcal/', 'http', $this->getUrl(), 1);
141 $this->url = (string) $purged;
142 }
143 }

References getUrl().

Referenced by initCurl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPass()

ilCalendarRemoteReader::setPass ( string  $a_pass)

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

55 : void
56 {
57 $this->pass = $a_pass;
58 }

◆ setUser()

ilCalendarRemoteReader::setUser ( string  $a_user)

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

50 : void
51 {
52 $this->user = $a_user;
53 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $curl

ilCurlConnection ilCalendarRemoteReader::$curl = null
private

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

◆ $ical

string ilCalendarRemoteReader::$ical = ''
private

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

◆ $logger

ilLogger ilCalendarRemoteReader::$logger
private

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

◆ $pass

string ilCalendarRemoteReader::$pass = ''
private

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

◆ $type

int ilCalendarRemoteReader::$type = self::TYPE_ICAL
private

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

Referenced by getType().

◆ $url

string ilCalendarRemoteReader::$url = ''
private

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

Referenced by getUrl().

◆ $user

string ilCalendarRemoteReader::$user = ''
private

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

◆ TYPE_ICAL

const ilCalendarRemoteReader::TYPE_ICAL = 1
protected

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

Referenced by import(), and read().


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