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

Model of calendar entry recurrcences based on iCalendar-RFC-5545. More...

+ Inheritance diagram for ilCalendarRecurrence:
+ Collaboration diagram for ilCalendarRecurrence:

Public Member Functions

 __construct (int $a_rec_id=0)
 
 toICal (int $a_user_id)
 Get ical presentation for calendar recurrence. More...
 
 reset ()
 reset all settings More...
 
 getRecurrenceId ()
 
 setEntryId (int $a_id)
 
 getEntryId ()
 
 setRecurrence (int $a_type)
 set type of recurrence @access public More...
 
 isRecurrence ()
 
 setFrequenceType (string $a_type)
 
 getFrequenceType ()
 Get Frequence type of recurrence. More...
 
 getFrequenceUntilDate ()
 Get end data of recurrence. More...
 
 setFrequenceUntilDate (?ilDateTime $a_date=null)
 
 setFrequenceUntilCount (int $a_count)
 
 getFrequenceUntilCount ()
 Get number of recurrences. More...
 
 setInterval (int $a_interval)
 
 getInterval ()
 Get interval of recurrence. More...
 
 setBYDAY (string $a_byday)
 3.8.5.3. More...
 
 getBYDAY ()
 
 getBYDAYList ()
 @inheritDoc More...
 
 setBYWEEKNO (string $a_byweekno)
 
 getBYWEEKNOList ()
 Get BYWEEKNOList. More...
 
 getBYWEEKNO ()
 
 setBYMONTH (string $a_by)
 
 getBYMONTH ()
 
 getBYMONTHList ()
 Get BYMONTHList. More...
 
 setBYMONTHDAY (string $a_by)
 
 getBYMONTHDAY ()
 
 getBYMONTHDAYList ()
 Get BYMONTHDAY List. More...
 
 setBYYEARDAY (string $a_by)
 
 getBYYEARDAY ()
 
 getBYYEARDAYList ()
 Get BYYEARDAYLIST. More...
 
 setBYSETPOS (string $a_by)
 
 getBYSETPOS ()
 
 getBYSETPOSList ()
 Get BYSETPOS List. More...
 
 setWeekstart (string $a_start)
 
 getWeekstart ()
 
 getTimeZone ()
 Get timezone of recurrence. More...
 
 setTimeZone (string $a_tz)
 
 getExclusionDates ()
 
 validate ()
 validate More...
 
 save ()
 
 update ()
 
 delete ()
 
 getFrequenceType ()
 Get Frequence type of recurrence. More...
 
 getTimeZone ()
 Get timezone of recurrence. More...
 
 getFrequenceUntilCount ()
 Get number of recurrences. More...
 
 getFrequenceUntilDate ()
 Get end data of recurrence. More...
 
 getInterval ()
 Get interval of recurrence. More...
 
 getBYMONTHList ()
 Get BYMONTHList. More...
 
 getBYWEEKNOList ()
 Get BYWEEKNOList. More...
 
 getBYYEARDAYList ()
 Get BYYEARDAYLIST. More...
 
 getBYMONTHDAYList ()
 Get BYMONTHDAY List. More...
 
 getBYDAYList ()
 Get BYDAY List. More...
 
 getBYSETPOSList ()
 Get BYSETPOS List. More...
 
 getExclusionDates ()
 Get exclusion date object. More...
 
 validate ()
 validate recurrence More...
 

Static Public Member Functions

static _delete (int $a_cal_id)
 

Data Fields

const string FREQ_NONE = 'NONE'
 
const string FREQ_DAILY = 'DAILY'
 
const string FREQ_WEEKLY = 'WEEKLY'
 
const string FREQ_MONTHLY = 'MONTHLY'
 
const string FREQ_YEARLY = 'YEARLY'
 

Protected Attributes

const int REC_RECURRENCE = 0
 
const int REC_EXCLUSION = 1
 
ilDBInterface $db
 

Private Member Functions

 read ()
 

Private Attributes

int $recurrence_id = 0
 
int $cal_id = 0
 
int $recurrence_type = 0
 
string $freq_type = ''
 
string $freq_until_type = ''
 
ilDate $freq_until_date = null
 
int $freq_until_count = 0
 
int $interval = 1
 
string $byday = ''
 
string $byweekno = ''
 
string $bymonth = ''
 
string $bymonthday = ''
 
string $byyearday = ''
 
string $bysetpos = ''
 
string $weekstart = ''
 
array $exclusion_dates = array()
 
string $timezone = 'Europe/Berlin'
 

Detailed Description

Model of calendar entry recurrcences based on iCalendar-RFC-5545.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRecurrence::__construct ( int  $a_rec_id = 0)

Definition at line 63 of file class.ilCalendarRecurrence.php.

64 {
65 global $DIC;
66
67 $this->db = $DIC->database();
68 $this->recurrence_id = $a_rec_id;
69 if ($a_rec_id) {
70 $this->read();
71 }
72 }
global $DIC
Definition: shib_login.php:26

References $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _delete()

static ilCalendarRecurrence::_delete ( int  $a_cal_id)
static

Definition at line 74 of file class.ilCalendarRecurrence.php.

74 : void
75 {
76 global $DIC;
77
78 $ilDB = $DIC['ilDB'];
79 $query = "DELETE FROM cal_recurrence_rules " .
80 "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
81 $res = $ilDB->manipulate($query);
82
84 }
static delete(int $a_cal_id)
Delete exclusion dates of calendar entry.
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, and ilCalendarRecurrenceExclusions\delete().

Referenced by ilCalendarEntry\_delete(), and ilCalendarEntry\delete().

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

◆ delete()

ilCalendarRecurrence::delete ( )

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 474 of file class.ilCalendarRecurrence.php.

474 : void
475 {
476 $query = "DELETE FROM cal_recurrence_rules " .
477 "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer');
478 $res = $this->db->manipulate($query);
479 }

References $res.

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

Definition at line 241 of file class.ilCalendarRecurrence.php.

241 : string
242 {
243 return $this->byday;
244 }

References $byday.

Referenced by getBYDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

@inheritDoc

Implements ilCalendarRecurrenceCalculation.

Definition at line 249 of file class.ilCalendarRecurrence.php.

249 : array
250 {
251 if (!trim($this->getBYDAY())) {
252 return array();
253 }
254 $bydays = [];
255 foreach (explode(',', $this->getBYDAY()) as $byday) {
256 $bydays[] = trim($byday);
257 }
258 return $bydays;
259 }

References $byday, and getBYDAY().

+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

Definition at line 288 of file class.ilCalendarRecurrence.php.

288 : string
289 {
290 return $this->bymonth;
291 }

References $bymonth.

Referenced by getBYMONTHList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

Definition at line 310 of file class.ilCalendarRecurrence.php.

310 : string
311 {
312 return $this->bymonthday;
313 }

References $bymonthday.

Referenced by getBYMONTHDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYMONTHDAYList()

ilCalendarRecurrence::getBYMONTHDAYList ( )

Get BYMONTHDAY List.

Returns
int[] array of "month day" items [1,31]

Implements ilCalendarRecurrenceCalculation.

Definition at line 315 of file class.ilCalendarRecurrence.php.

315 : array
316 {
317 if (!trim($this->getBYMONTHDAY())) {
318 return array();
319 }
320 $month = [];
321 foreach (explode(',', $this->getBYMONTHDAY()) as $month_num) {
322 $month[] = (int) $month_num;
323 }
324 return $month;
325 }

References getBYMONTHDAY(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBYMONTHList()

ilCalendarRecurrence::getBYMONTHList ( )

Get BYMONTHList.

Returns
int[] array of "by month" items: [1,12]

Implements ilCalendarRecurrenceCalculation.

Definition at line 293 of file class.ilCalendarRecurrence.php.

293 : array
294 {
295 if (!trim($this->getBYMONTH())) {
296 return array();
297 }
298 $months = [];
299 foreach (explode(',', $this->getBYMONTH()) as $month_num) {
300 $months[] = (int) $month_num;
301 }
302 return $months;
303 }

References getBYMONTH(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

Definition at line 354 of file class.ilCalendarRecurrence.php.

354 : string
355 {
356 return $this->bysetpos;
357 }

References $bysetpos.

Referenced by getBYSETPOSList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYSETPOSList()

ilCalendarRecurrence::getBYSETPOSList ( )

Get BYSETPOS List.

Implements ilCalendarRecurrenceCalculation.

Definition at line 359 of file class.ilCalendarRecurrence.php.

359 : array
360 {
361 if (!trim($this->getBYSETPOS())) {
362 return array();
363 }
364 $positions = [];
365 foreach (explode(',', $this->getBYSETPOS()) as $pos) {
366 $positions[] = (int) $pos;
367 }
368 return $positions;
369 }

References getBYSETPOS(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

Definition at line 278 of file class.ilCalendarRecurrence.php.

278 : string
279 {
280 return $this->byweekno;
281 }

References $byweekno.

Referenced by getBYWEEKNOList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYWEEKNOList()

ilCalendarRecurrence::getBYWEEKNOList ( )

Get BYWEEKNOList.

Returns
int[] array of "by week no" items: [1,54]

Implements ilCalendarRecurrenceCalculation.

Definition at line 266 of file class.ilCalendarRecurrence.php.

266 : array
267 {
268 if (!trim($this->getBYWEEKNO())) {
269 return array();
270 }
271 $weeks = [];
272 foreach (explode(',', $this->getBYWEEKNO()) as $week_num) {
273 $weeks[] = (int) $week_num;
274 }
275 return $weeks;
276 }

References getBYWEEKNO(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

Definition at line 332 of file class.ilCalendarRecurrence.php.

332 : string
333 {
334 return $this->byyearday;
335 }

References $byyearday.

Referenced by getBYYEARDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYYEARDAYList()

ilCalendarRecurrence::getBYYEARDAYList ( )

Get BYYEARDAYLIST.

Returns
int[] array of "year day" items [1,365]

Implements ilCalendarRecurrenceCalculation.

Definition at line 337 of file class.ilCalendarRecurrence.php.

337 : array
338 {
339 if (!trim($this->getBYYEARDAY())) {
340 return array();
341 }
342 $days = [];
343 foreach (explode(',', $this->getBYYEARDAY()) as $year_day) {
344 $days[] = (int) $year_day;
345 }
346 return $days;
347 }

References getBYYEARDAY(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

Definition at line 172 of file class.ilCalendarRecurrence.php.

172 : int
173 {
174 return $this->cal_id;
175 }

References $cal_id.

Referenced by toICal().

+ Here is the caller graph for this function:

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )
Returns
ilCalendarRecurrenceExclusion[]

Implements ilCalendarRecurrenceCalculation.

Definition at line 394 of file class.ilCalendarRecurrence.php.

394 : array
395 {
397 }

References $exclusion_dates.

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

Get Frequence type of recurrence.

Implements ilCalendarRecurrenceCalculation.

Definition at line 197 of file class.ilCalendarRecurrence.php.

197 : string
198 {
199 return $this->freq_type;
200 }

References $freq_type.

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getFrequenceUntilCount()

ilCalendarRecurrence::getFrequenceUntilCount ( )

Get number of recurrences.

Implements ilCalendarRecurrenceCalculation.

Definition at line 217 of file class.ilCalendarRecurrence.php.

217 : int
218 {
220 }

References $freq_until_count.

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getFrequenceUntilDate()

ilCalendarRecurrence::getFrequenceUntilDate ( )

Get end data of recurrence.

Implements ilCalendarRecurrenceCalculation.

Definition at line 202 of file class.ilCalendarRecurrence.php.

202 : ?ilDate
203 {
204 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
205 }
Class for single dates.

Referenced by save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getInterval()

ilCalendarRecurrence::getInterval ( )

Get interval of recurrence.

Implements ilCalendarRecurrenceCalculation.

Definition at line 227 of file class.ilCalendarRecurrence.php.

227 : int
228 {
229 return $this->interval;
230 }

References $interval.

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

Definition at line 162 of file class.ilCalendarRecurrence.php.

162 : int
163 {
165 }

References $recurrence_id.

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

Get timezone of recurrence.

Implements ilCalendarRecurrenceCalculation.

Definition at line 381 of file class.ilCalendarRecurrence.php.

381 : string
382 {
383 return $this->timezone;
384 }

References $timezone.

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

Definition at line 376 of file class.ilCalendarRecurrence.php.

376 : string
377 {
378 return $this->weekstart;
379 }

References $weekstart.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ isRecurrence()

ilCalendarRecurrence::isRecurrence ( )

Definition at line 187 of file class.ilCalendarRecurrence.php.

187 : bool
188 {
189 return $this->recurrence_type == self::REC_RECURRENCE;
190 }

References REC_RECURRENCE.

◆ read()

ilCalendarRecurrence::read ( )
private

Definition at line 481 of file class.ilCalendarRecurrence.php.

481 : void
482 {
483 $query = "SELECT * FROM cal_recurrence_rules " .
484 "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
485 $res = $this->db->query($query);
486 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
487 $this->cal_id = (int) $row->cal_id;
488 $this->recurrence_type = (int) $row->cal_recurrence;
489 $this->freq_type = (string) $row->freq_type;
490
491 if ($row->freq_until_date != null) {
492 $this->freq_until_date = new ilDate($row->freq_until_date, IL_CAL_DATETIME);
493 }
494 $this->freq_until_count = (int) $row->freq_until_count;
495 $this->interval = (int) $row->intervall;
496 $this->byday = (string) $row->byday;
497 $this->byweekno = (string) $row->byweekno;
498 $this->bymonth = (string) $row->bymonth;
499 $this->bymonthday = (string) $row->bymonthday;
500 $this->byyearday = (string) $row->byyearday;
501 $this->bysetpos = (string) $row->bysetpos;
502 $this->weekstart = (string) $row->weekstart;
503 }
504
505 $this->exclusion_dates = ilCalendarRecurrenceExclusions::getExclusionDates($this->cal_id);
506 }
const IL_CAL_DATETIME
static getExclusionDates($a_cal_id)
Read exclusion dates.
if(!file_exists('../ilias.ini.php'))

References $res, ilDBConstants\FETCHMODE_OBJECT, ilCalendarRecurrenceExclusions\getExclusionDates(), if, IL_CAL_DATETIME, and ILIAS\Repository\int().

Referenced by __construct().

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

◆ reset()

ilCalendarRecurrence::reset ( )

reset all settings

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

148 : void
149 {
150 $this->setBYDAY('');
151 $this->setBYMONTHDAY('');
152 $this->setBYMONTH('');
153 $this->setBYSETPOS('');
154 $this->setBYWEEKNO('');
155 $this->setBYYEARDAY('');
156 $this->setFrequenceType('');
157 $this->setInterval(1);
158 $this->setFrequenceUntilCount(0);
159 $this->setFrequenceUntilDate(null);
160 }
setBYDAY(string $a_byday)
3.8.5.3.
setFrequenceUntilDate(?ilDateTime $a_date=null)

References setBYDAY(), setBYMONTH(), setBYMONTHDAY(), setBYSETPOS(), setBYWEEKNO(), setBYYEARDAY(), setFrequenceType(), setFrequenceUntilCount(), setFrequenceUntilDate(), and setInterval().

+ Here is the call graph for this function:

◆ save()

ilCalendarRecurrence::save ( )

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 421 of file class.ilCalendarRecurrence.php.

421 : void
422 {
423 $until_date = is_null($this->getFrequenceUntilDate()) ?
424 null :
425 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
426 $next_id = $this->db->nextId('cal_recurrence_rules');
427
428 $query = "INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
429 "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
430 "VALUES( " .
431 $this->db->quote($next_id, 'integer') . ", " .
432 $this->db->quote($this->cal_id, 'integer') . ", " .
433 $this->db->quote(1, 'integer') . ", " .
434 $this->db->quote($this->getFrequenceType(), 'text') . ", " .
435 $this->db->quote($until_date, 'timestamp') . ", " .
436 $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
437 $this->db->quote($this->getInterval(), 'integer') . ", " .
438 $this->db->quote($this->getBYDAY(), 'text') . ", " .
439 $this->db->quote($this->getBYWEEKNO(), 'text') . ", " .
440 $this->db->quote($this->getBYMONTH(), 'text') . ", " .
441 $this->db->quote($this->getBYMONTHDAY(), 'text') . ", " .
442 $this->db->quote($this->getBYYEARDAY(), 'text') . ", " .
443 $this->db->quote($this->getBYSETPOS(), 'text') . ", " .
444 $this->db->quote($this->getWeekstart(), 'text') . " " .
445 ")";
446 $res = $this->db->manipulate($query);
447 $this->recurrence_id = $next_id;
448 }
getFrequenceType()
Get Frequence type of recurrence.
getFrequenceUntilCount()
Get number of recurrences.
getInterval()
Get interval of recurrence.
getFrequenceUntilDate()
Get end data of recurrence.

References $res, getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), getWeekstart(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ setBYDAY()

ilCalendarRecurrence::setBYDAY ( string  $a_byday)

3.8.5.3.

Recurrence Rule example: BYDAY=TU,TH

Definition at line 236 of file class.ilCalendarRecurrence.php.

236 : void
237 {
238 $this->byday = $a_byday;
239 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH ( string  $a_by)

Definition at line 283 of file class.ilCalendarRecurrence.php.

283 : void
284 {
285 $this->bymonth = $a_by;
286 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY ( string  $a_by)

Definition at line 305 of file class.ilCalendarRecurrence.php.

305 : void
306 {
307 $this->bymonthday = $a_by;
308 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS ( string  $a_by)

Definition at line 349 of file class.ilCalendarRecurrence.php.

349 : void
350 {
351 $this->bysetpos = $a_by;
352 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO ( string  $a_byweekno)

Definition at line 261 of file class.ilCalendarRecurrence.php.

261 : void
262 {
263 $this->byweekno = $a_byweekno;
264 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY ( string  $a_by)

Definition at line 327 of file class.ilCalendarRecurrence.php.

327 : void
328 {
329 $this->byyearday = $a_by;
330 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrence::setEntryId ( int  $a_id)

Definition at line 167 of file class.ilCalendarRecurrence.php.

167 : void
168 {
169 $this->cal_id = $a_id;
170 }

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType ( string  $a_type)

Definition at line 192 of file class.ilCalendarRecurrence.php.

192 : void
193 {
194 $this->freq_type = $a_type;
195 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount ( int  $a_count)

Definition at line 212 of file class.ilCalendarRecurrence.php.

212 : void
213 {
214 $this->freq_until_count = $a_count;
215 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setFrequenceUntilDate()

ilCalendarRecurrence::setFrequenceUntilDate ( ?ilDateTime  $a_date = null)

Definition at line 207 of file class.ilCalendarRecurrence.php.

207 : void
208 {
209 $this->freq_until_date = $a_date;
210 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setInterval()

ilCalendarRecurrence::setInterval ( int  $a_interval)

Definition at line 222 of file class.ilCalendarRecurrence.php.

222 : void
223 {
224 $this->interval = $a_interval;
225 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setRecurrence()

ilCalendarRecurrence::setRecurrence ( int  $a_type)

set type of recurrence @access public

Parameters
intREC_RECURRENCE or REC_EXLUSION defines whther the current object is a recurrence an exclusion pattern

Definition at line 182 of file class.ilCalendarRecurrence.php.

182 : void
183 {
184 $this->recurrence_type = $a_type;
185 }

Referenced by ilObjSessionGUI\initForm().

+ Here is the caller graph for this function:

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone ( string  $a_tz)

Definition at line 386 of file class.ilCalendarRecurrence.php.

386 : void
387 {
388 $this->timezone = $a_tz;
389 }

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart ( string  $a_start)

Definition at line 371 of file class.ilCalendarRecurrence.php.

371 : void
372 {
373 $this->weekstart = $a_start;
374 }

◆ toICal()

ilCalendarRecurrence::toICal ( int  $a_user_id)

Get ical presentation for calendar recurrence.

Definition at line 89 of file class.ilCalendarRecurrence.php.

89 : string
90 {
91 $entry = new ilCalendarEntry($this->getEntryId());
92
93 if (!$this->getFrequenceType()) {
94 return '';
95 }
96
97 $ical = 'RRULE:';
98 $ical .= ('FREQ=' . $this->getFrequenceType());
99
100 if ($this->getInterval()) {
101 $ical .= (';INTERVAL=' . $this->getInterval());
102 }
103 if ($this->getFrequenceUntilCount()) {
104 $ical .= (';COUNT=' . $this->getFrequenceUntilCount());
105 } elseif ($this->getFrequenceUntilDate()) {
106 if ($entry->isFullday()) {
107 $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd'));
108 } else {
109 $his = $entry->getStart()->get(IL_CAL_FKT_DATE, 'His');
110 $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd') . 'T' . $his);
111 }
112 }
113 if ($this->getBYMONTH()) {
114 $ical .= (';BYMONTH=' . $this->getBYMONTH());
115 }
116 if ($this->getBYWEEKNO()) {
117 $ical .= (';BYWEEKNO=' . $this->getBYWEEKNO());
118 }
119 if ($this->getBYYEARDAY()) {
120 $ical .= (';BYYEARDAY=' . $this->getBYYEARDAY());
121 }
122 if ($this->getBYMONTHDAY()) {
123 $ical .= (';BYMONTHDAY=' . $this->getBYMONTHDAY());
124 }
125 if ($this->getBYDAY()) {
126 $ical .= (';BYDAY=' . $this->getBYDAY());
127 }
128 if ($this->getBYSETPOS()) {
129 $ical .= (';BYSETPOS=' . $this->getBYSETPOS());
130 }
131
132 // Required in outlook
133 if ($this->getBYDAY()) {
135 if ($us->getWeekStart() == ilCalendarSettings::WEEK_START_MONDAY) {
136 $ical .= (';WKST=MO');
137 } else {
138 $ical .= (';WKST=SU');
139 }
140 }
141
142 return $ical;
143 }
const IL_CAL_FKT_DATE
Model for a calendar entry.
static _getInstanceByUserId(int $a_user_id)

References ilCalendarUserSettings\_getInstanceByUserId(), getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getEntryId(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), IL_CAL_FKT_DATE, and ilCalendarSettings\WEEK_START_MONDAY.

+ Here is the call graph for this function:

◆ update()

ilCalendarRecurrence::update ( )

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 450 of file class.ilCalendarRecurrence.php.

450 : void
451 {
452 $until_date = is_null($this->getFrequenceUntilDate()) ?
453 null :
454 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
455
456 $query = "UPDATE cal_recurrence_rules SET " .
457 "cal_id = " . $this->db->quote($this->cal_id, 'integer') . ", " .
458 "cal_recurrence = 1," .
459 "freq_type = " . $this->db->quote($this->getFrequenceType(), 'text') . ", " .
460 "freq_until_date = " . $this->db->quote($until_date, 'timestamp') . ", " .
461 "freq_until_count = " . $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
462 "intervall = " . $this->db->quote($this->getInterval(), 'integer') . ", " .
463 "byday = " . $this->db->quote($this->getBYDAY(), 'text') . ", " .
464 "byweekno = " . $this->db->quote($this->getBYWEEKNO(), 'text') . ", " .
465 "bymonth = " . $this->db->quote($this->getBYMONTH(), 'text') . ", " .
466 "bymonthday = " . $this->db->quote($this->getBYMONTHDAY(), 'text') . ", " .
467 "byyearday = " . $this->db->quote($this->getBYYEARDAY(), 'text') . ", " .
468 "bysetpos = " . $this->db->quote($this->getBYSETPOS(), 'text') . ", " .
469 "weekstart = " . $this->db->quote($this->getWeekstart(), 'text') . " " .
470 "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
471 $res = $this->db->manipulate($query);
472 }

References $res, getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), getWeekstart(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ validate()

ilCalendarRecurrence::validate ( )

validate

Implements ilCalendarRecurrenceCalculation.

Definition at line 402 of file class.ilCalendarRecurrence.php.

402 : bool
403 {
404 $valid_frequences = array(self::FREQ_DAILY,
405 self::FREQ_WEEKLY,
406 self::FREQ_MONTHLY,
407 self::FREQ_YEARLY
408 );
409 if (!in_array($this->getFrequenceType(), $valid_frequences)) {
410 return false;
411 }
412 if ($this->getFrequenceUntilCount() < 0) {
413 return false;
414 }
415 if ($this->getInterval() <= 0) {
416 return false;
417 }
418 return true;
419 }

References getFrequenceType(), getFrequenceUntilCount(), and getInterval().

+ Here is the call graph for this function:

Field Documentation

◆ $byday

string ilCalendarRecurrence::$byday = ''
private

Definition at line 51 of file class.ilCalendarRecurrence.php.

Referenced by getBYDAY(), and getBYDAYList().

◆ $bymonth

string ilCalendarRecurrence::$bymonth = ''
private

Definition at line 53 of file class.ilCalendarRecurrence.php.

Referenced by getBYMONTH().

◆ $bymonthday

string ilCalendarRecurrence::$bymonthday = ''
private

Definition at line 54 of file class.ilCalendarRecurrence.php.

Referenced by getBYMONTHDAY().

◆ $bysetpos

string ilCalendarRecurrence::$bysetpos = ''
private

Definition at line 56 of file class.ilCalendarRecurrence.php.

Referenced by getBYSETPOS().

◆ $byweekno

string ilCalendarRecurrence::$byweekno = ''
private

Definition at line 52 of file class.ilCalendarRecurrence.php.

Referenced by getBYWEEKNO().

◆ $byyearday

string ilCalendarRecurrence::$byyearday = ''
private

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

Referenced by getBYYEARDAY().

◆ $cal_id

int ilCalendarRecurrence::$cal_id = 0
private

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

Referenced by getEntryId().

◆ $db

ilDBInterface ilCalendarRecurrence::$db
protected

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

◆ $exclusion_dates

array ilCalendarRecurrence::$exclusion_dates = array()
private

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

Referenced by getExclusionDates().

◆ $freq_type

string ilCalendarRecurrence::$freq_type = ''
private

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

Referenced by getFrequenceType().

◆ $freq_until_count

int ilCalendarRecurrence::$freq_until_count = 0
private

Definition at line 48 of file class.ilCalendarRecurrence.php.

Referenced by getFrequenceUntilCount().

◆ $freq_until_date

ilDate ilCalendarRecurrence::$freq_until_date = null
private

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

◆ $freq_until_type

string ilCalendarRecurrence::$freq_until_type = ''
private

Definition at line 46 of file class.ilCalendarRecurrence.php.

◆ $interval

int ilCalendarRecurrence::$interval = 1
private

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

Referenced by getInterval().

◆ $recurrence_id

int ilCalendarRecurrence::$recurrence_id = 0
private

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

Referenced by getRecurrenceId().

◆ $recurrence_type

int ilCalendarRecurrence::$recurrence_type = 0
private

Definition at line 43 of file class.ilCalendarRecurrence.php.

◆ $timezone

string ilCalendarRecurrence::$timezone = 'Europe/Berlin'
private

Definition at line 61 of file class.ilCalendarRecurrence.php.

Referenced by getTimeZone().

◆ $weekstart

string ilCalendarRecurrence::$weekstart = ''
private

Definition at line 57 of file class.ilCalendarRecurrence.php.

Referenced by getWeekstart().

◆ FREQ_DAILY

◆ FREQ_MONTHLY

◆ FREQ_NONE

const string ilCalendarRecurrence::FREQ_NONE = 'NONE'

◆ FREQ_WEEKLY

◆ FREQ_YEARLY

◆ REC_EXCLUSION

const int ilCalendarRecurrence::REC_EXCLUSION = 1
protected

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

◆ REC_RECURRENCE

const int ilCalendarRecurrence::REC_RECURRENCE = 0
protected

Definition at line 30 of file class.ilCalendarRecurrence.php.

Referenced by isRecurrence().


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