ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 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 ()
 
 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 ()
 

Static Public Member Functions

static _delete (int $a_cal_id)
 

Data Fields

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

Protected Attributes

const REC_RECURRENCE = 0
 
const 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.

References $DIC, and read().

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:22
+ 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.

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

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

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:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarRecurrence::delete ( )

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

References $res.

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

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

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

References $byday.

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

240  : string
241  {
242  return $this->byday;
243  }
+ Here is the caller graph for this function:

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

Implements ilCalendarRecurrenceCalculation.

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

References getBYDAY().

248  : array
249  {
250  if (!trim($this->getBYDAY())) {
251  return array();
252  }
253  $bydays = [];
254  foreach (explode(',', $this->getBYDAY()) as $byday) {
255  $bydays[] = trim($byday);
256  }
257  return $bydays;
258  }
+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

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

References $bymonth.

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

287  : string
288  {
289  return $this->bymonth;
290  }
+ Here is the caller graph for this function:

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

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

References $bymonthday.

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

309  : string
310  {
311  return $this->bymonthday;
312  }
+ 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 314 of file class.ilCalendarRecurrence.php.

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

314  : array
315  {
316  if (!trim($this->getBYMONTHDAY())) {
317  return array();
318  }
319  $month = [];
320  foreach (explode(',', $this->getBYMONTHDAY()) as $month_num) {
321  $month[] = (int) $month_num;
322  }
323  return $month;
324  }
+ 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 292 of file class.ilCalendarRecurrence.php.

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

292  : array
293  {
294  if (!trim($this->getBYMONTH())) {
295  return array();
296  }
297  $months = [];
298  foreach (explode(',', $this->getBYMONTH()) as $month_num) {
299  $months[] = (int) $month_num;
300  }
301  return $months;
302  }
+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

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

References $bysetpos.

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

353  : string
354  {
355  return $this->bysetpos;
356  }
+ Here is the caller graph for this function:

◆ getBYSETPOSList()

ilCalendarRecurrence::getBYSETPOSList ( )

Get BYSETPOS List.

Implements ilCalendarRecurrenceCalculation.

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

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

358  : array
359  {
360  if (!trim($this->getBYSETPOS())) {
361  return array();
362  }
363  $positions = [];
364  foreach (explode(',', $this->getBYSETPOS()) as $pos) {
365  $positions[] = (int) $pos;
366  }
367  return $positions;
368  }
+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

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

References $byweekno.

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

277  : string
278  {
279  return $this->byweekno;
280  }
+ 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 265 of file class.ilCalendarRecurrence.php.

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

265  : array
266  {
267  if (!trim($this->getBYWEEKNO())) {
268  return array();
269  }
270  $weeks = [];
271  foreach (explode(',', $this->getBYWEEKNO()) as $week_num) {
272  $weeks[] = (int) $week_num;
273  }
274  return $weeks;
275  }
+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

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

References $byyearday.

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

331  : string
332  {
333  return $this->byyearday;
334  }
+ 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 336 of file class.ilCalendarRecurrence.php.

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

336  : array
337  {
338  if (!trim($this->getBYYEARDAY())) {
339  return array();
340  }
341  $days = [];
342  foreach (explode(',', $this->getBYYEARDAY()) as $year_day) {
343  $days[] = (int) $year_day;
344  }
345  return $days;
346  }
+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

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

References $cal_id.

Referenced by toICal().

171  : int
172  {
173  return $this->cal_id;
174  }
+ Here is the caller graph for this function:

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )
Returns
ilCalendarRecurrenceExclusion[]

Implements ilCalendarRecurrenceCalculation.

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

References $exclusion_dates.

393  : array
394  {
395  return $this->exclusion_dates;
396  }

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

Get Frequence type of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References $freq_type.

Referenced by ilObjEmployeeTalkSeriesGUI\copyTemplateValues(), ilEmployeeTalkAppointmentGUI\loadRecurrenceSettings(), save(), toICal(), update(), and validate().

196  : string
197  {
198  return $this->freq_type;
199  }
+ Here is the caller graph for this function:

◆ getFrequenceUntilCount()

ilCalendarRecurrence::getFrequenceUntilCount ( )

Get number of recurrences.

Implements ilCalendarRecurrenceCalculation.

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

References $freq_until_count.

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

216  : int
217  {
219  }
+ Here is the caller graph for this function:

◆ getFrequenceUntilDate()

ilCalendarRecurrence::getFrequenceUntilDate ( )

Get end data of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References null.

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

201  : ?ilDate
202  {
203  return is_object($this->freq_until_date) ? $this->freq_until_date : null;
204  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getInterval()

ilCalendarRecurrence::getInterval ( )

Get interval of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References $interval.

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

226  : int
227  {
228  return $this->interval;
229  }
+ Here is the caller graph for this function:

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

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

References $recurrence_id.

161  : int
162  {
163  return $this->recurrence_id;
164  }

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

Get timezone of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References $timezone.

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

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

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

References $weekstart.

Referenced by save(), and update().

375  : string
376  {
377  return $this->weekstart;
378  }
+ Here is the caller graph for this function:

◆ isRecurrence()

ilCalendarRecurrence::isRecurrence ( )

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

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

◆ read()

ilCalendarRecurrence::read ( )
private

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

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

Referenced by __construct().

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

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

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  }
setBYDAY(string $a_byday)
3.8.5.3.
+ Here is the call graph for this function:

◆ save()

ilCalendarRecurrence::save ( )

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

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

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

Referenced by reset().

235  : void
236  {
237  $this->byday = $a_byday;
238  }
+ Here is the caller graph for this function:

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH ( string  $a_by)

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

Referenced by reset().

282  : void
283  {
284  $this->bymonth = $a_by;
285  }
+ Here is the caller graph for this function:

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY ( string  $a_by)

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

Referenced by reset().

304  : void
305  {
306  $this->bymonthday = $a_by;
307  }
+ Here is the caller graph for this function:

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS ( string  $a_by)

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

Referenced by reset().

348  : void
349  {
350  $this->bysetpos = $a_by;
351  }
+ Here is the caller graph for this function:

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO ( string  $a_byweekno)

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

Referenced by reset().

260  : void
261  {
262  $this->byweekno = $a_byweekno;
263  }
+ Here is the caller graph for this function:

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY ( string  $a_by)

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

Referenced by reset().

326  : void
327  {
328  $this->byyearday = $a_by;
329  }
+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrence::setEntryId ( int  $a_id)

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

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

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType ( string  $a_type)

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

Referenced by reset().

191  : void
192  {
193  $this->freq_type = $a_type;
194  }
+ Here is the caller graph for this function:

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount ( int  $a_count)

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

Referenced by reset().

211  : void
212  {
213  $this->freq_until_count = $a_count;
214  }
+ Here is the caller graph for this function:

◆ setFrequenceUntilDate()

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

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

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

◆ setInterval()

ilCalendarRecurrence::setInterval ( int  $a_interval)

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

Referenced by reset().

221  : void
222  {
223  $this->interval = $a_interval;
224  }
+ Here is the caller graph for this function:

◆ setRecurrence()

ilCalendarRecurrence::setRecurrence ( int  $a_type)

set type of recurrence public

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

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

Referenced by ilCalendarAppointmentGUI\initForm(), and ilObjSessionGUI\initForm().

181  : void
182  {
183  $this->recurrence_type = $a_type;
184  }
+ Here is the caller graph for this function:

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone ( string  $a_tz)

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

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

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart ( string  $a_start)

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

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

◆ toICal()

ilCalendarRecurrence::toICal ( int  $a_user_id)

Get ical presentation for calendar recurrence.

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

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

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  }
static _getInstanceByUserId(int $a_user_id)
getFrequenceType()
Get Frequence type of recurrence.
const IL_CAL_FKT_DATE
getFrequenceUntilDate()
Get end data of recurrence.
getInterval()
Get interval of recurrence.
getFrequenceUntilCount()
Get number of recurrences.
+ Here is the call graph for this function:

◆ update()

ilCalendarRecurrence::update ( )

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

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

449  : void
450  {
451  $until_date = is_null($this->getFrequenceUntilDate()) ?
452  null :
453  $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
454 
455  $query = "UPDATE cal_recurrence_rules SET " .
456  "cal_id = " . $this->db->quote($this->cal_id, 'integer') . ", " .
457  "cal_recurrence = 1," .
458  "freq_type = " . $this->db->quote($this->getFrequenceType(), 'text') . ", " .
459  "freq_until_date = " . $this->db->quote($until_date, 'timestamp') . ", " .
460  "freq_until_count = " . $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
461  "intervall = " . $this->db->quote($this->getInterval(), 'integer') . ", " .
462  "byday = " . $this->db->quote($this->getBYDAY(), 'text') . ", " .
463  "byweekno = " . $this->db->quote($this->getBYWEEKNO(), 'text') . ", " .
464  "bymonth = " . $this->db->quote($this->getBYMONTH(), 'text') . ", " .
465  "bymonthday = " . $this->db->quote($this->getBYMONTHDAY(), 'text') . ", " .
466  "byyearday = " . $this->db->quote($this->getBYYEARDAY(), 'text') . ", " .
467  "bysetpos = " . $this->db->quote($this->getBYSETPOS(), 'text') . ", " .
468  "weekstart = " . $this->db->quote($this->getWeekstart(), 'text') . " " .
469  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
470  $res = $this->db->manipulate($query);
471  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
getFrequenceType()
Get Frequence type of recurrence.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFrequenceUntilDate()
Get end data of recurrence.
getInterval()
Get interval of recurrence.
getFrequenceUntilCount()
Get number of recurrences.
+ Here is the call graph for this function:

◆ validate()

ilCalendarRecurrence::validate ( )

validate

Implements ilCalendarRecurrenceCalculation.

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

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

401  : bool
402  {
403  $valid_frequences = array(self::FREQ_DAILY,
404  self::FREQ_WEEKLY,
405  self::FREQ_MONTHLY,
406  self::FREQ_YEARLY
407  );
408  if (!in_array($this->getFrequenceType(), $valid_frequences)) {
409  return false;
410  }
411  if ($this->getFrequenceUntilCount() < 0) {
412  return false;
413  }
414  if ($this->getInterval() <= 0) {
415  return false;
416  }
417  return true;
418  }
getFrequenceType()
Get Frequence type of recurrence.
getInterval()
Get interval of recurrence.
getFrequenceUntilCount()
Get number of recurrences.
+ 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().

◆ $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 ilCalendarRecurrence::FREQ_NONE = 'NONE'

◆ FREQ_WEEKLY

◆ FREQ_YEARLY

◆ REC_EXCLUSION

const ilCalendarRecurrence::REC_EXCLUSION = 1
protected

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

◆ REC_RECURRENCE

const ilCalendarRecurrence::REC_RECURRENCE = 0
protected

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


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