ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarRecurrence Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 29 of file class.ilCalendarRecurrence.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRecurrence::__construct ( int  $a_rec_id = 0)

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

References $DIC, and read().

65  {
66  global $DIC;
67 
68  $this->db = $DIC->database();
69  $this->recurrence_id = $a_rec_id;
70  if ($a_rec_id) {
71  $this->read();
72  }
73  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _delete()

static ilCalendarRecurrence::_delete ( int  $a_cal_id)
static

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

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

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

75  : void
76  {
77  global $DIC;
78 
79  $ilDB = $DIC['ilDB'];
80  $query = "DELETE FROM cal_recurrence_rules " .
81  "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
82  $res = $ilDB->manipulate($query);
83 
85  }
static delete(int $a_cal_id)
Delete exclusion dates of calendar entry.
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarRecurrence::delete ( )

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

References $query, and $res.

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  }
$res
Definition: ltiservices.php:69
$query

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

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

References $byday.

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

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

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

Implements ilCalendarRecurrenceCalculation.

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

References getBYDAY().

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  }
+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

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

References $bymonth.

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

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

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

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

References $bymonthday.

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

310  : string
311  {
312  return $this->bymonthday;
313  }
+ 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.

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

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  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

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

References $bysetpos.

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

354  : string
355  {
356  return $this->bysetpos;
357  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

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

References $byweekno.

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

278  : string
279  {
280  return $this->byweekno;
281  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

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

References $byyearday.

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

332  : string
333  {
334  return $this->byyearday;
335  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

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

References $cal_id.

Referenced by toICal().

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

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )
Returns
ilCalendarRecurrenceExclusion[]

Implements ilCalendarRecurrenceCalculation.

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

References $exclusion_dates.

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

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

Get Frequence type of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References $freq_type.

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

197  : string
198  {
199  return $this->freq_type;
200  }
+ 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.

References $freq_until_count.

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

217  : int
218  {
220  }
+ 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.

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

202  : ?ilDate
203  {
204  return is_object($this->freq_until_date) ? $this->freq_until_date : null;
205  }
+ 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.

References $interval.

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

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

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

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

References $recurrence_id.

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

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

Get timezone of recurrence.

Implements ilCalendarRecurrenceCalculation.

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

References $timezone.

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

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

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

References $weekstart.

Referenced by save(), and update().

376  : string
377  {
378  return $this->weekstart;
379  }
+ 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  }

◆ read()

ilCalendarRecurrence::read ( )
private

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

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

Referenced by __construct().

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  }
$res
Definition: ltiservices.php:69
const IL_CAL_DATETIME
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
$query
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 149 of file class.ilCalendarRecurrence.php.

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

149  : void
150  {
151  $this->setBYDAY('');
152  $this->setBYMONTHDAY('');
153  $this->setBYMONTH('');
154  $this->setBYSETPOS('');
155  $this->setBYWEEKNO('');
156  $this->setBYYEARDAY('');
157  $this->setFrequenceType('');
158  $this->setInterval(1);
159  $this->setFrequenceUntilCount(0);
160  }
setBYDAY(string $a_byday)
3.8.5.3.
+ Here is the call graph for this function:

◆ save()

ilCalendarRecurrence::save ( )

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

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

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  }
$res
Definition: ltiservices.php:69
const IL_CAL_DATETIME
getFrequenceType()
Get Frequence type of recurrence.
$query
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 236 of file class.ilCalendarRecurrence.php.

Referenced by reset().

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

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH ( string  $a_by)

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

Referenced by reset().

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

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY ( string  $a_by)

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

Referenced by reset().

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

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS ( string  $a_by)

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

Referenced by reset().

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

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO ( string  $a_byweekno)

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

Referenced by reset().

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

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY ( string  $a_by)

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

Referenced by reset().

327  : void
328  {
329  $this->byyearday = $a_by;
330  }
+ 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.

Referenced by reset().

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

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount ( int  $a_count)

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

Referenced by reset().

212  : void
213  {
214  $this->freq_until_count = $a_count;
215  }
+ 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  }

◆ setInterval()

ilCalendarRecurrence::setInterval ( int  $a_interval)

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

Referenced by reset().

222  : void
223  {
224  $this->interval = $a_interval;
225  }
+ 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 182 of file class.ilCalendarRecurrence.php.

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

182  : void
183  {
184  $this->recurrence_type = $a_type;
185  }
+ 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 90 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.

90  : string
91  {
92  $entry = new ilCalendarEntry($this->getEntryId());
93 
94  if (!$this->getFrequenceType()) {
95  return '';
96  }
97 
98  $ical = 'RRULE:';
99  $ical .= ('FREQ=' . $this->getFrequenceType());
100 
101  if ($this->getInterval()) {
102  $ical .= (';INTERVAL=' . $this->getInterval());
103  }
104  if ($this->getFrequenceUntilCount()) {
105  $ical .= (';COUNT=' . $this->getFrequenceUntilCount());
106  } elseif ($this->getFrequenceUntilDate()) {
107  if ($entry->isFullday()) {
108  $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd'));
109  } else {
110  $his = $entry->getStart()->get(IL_CAL_FKT_DATE, 'His');
111  $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd') . 'T' . $his);
112  }
113  }
114  if ($this->getBYMONTH()) {
115  $ical .= (';BYMONTH=' . $this->getBYMONTH());
116  }
117  if ($this->getBYWEEKNO()) {
118  $ical .= (';BYWEEKNO=' . $this->getBYWEEKNO());
119  }
120  if ($this->getBYYEARDAY()) {
121  $ical .= (';BYYEARDAY=' . $this->getBYYEARDAY());
122  }
123  if ($this->getBYMONTHDAY()) {
124  $ical .= (';BYMONTHDAY=' . $this->getBYMONTHDAY());
125  }
126  if ($this->getBYDAY()) {
127  $ical .= (';BYDAY=' . $this->getBYDAY());
128  }
129  if ($this->getBYSETPOS()) {
130  $ical .= (';BYSETPOS=' . $this->getBYSETPOS());
131  }
132 
133  // Required in outlook
134  if ($this->getBYDAY()) {
136  if ($us->getWeekStart() == ilCalendarSettings::WEEK_START_MONDAY) {
137  $ical .= (';WKST=MO');
138  } else {
139  $ical .= (';WKST=SU');
140  }
141  }
142 
143  return $ical;
144  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 450 of file class.ilCalendarRecurrence.php.

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

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  }
$res
Definition: ltiservices.php:69
const IL_CAL_DATETIME
getFrequenceType()
Get Frequence type of recurrence.
$query
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 402 of file class.ilCalendarRecurrence.php.

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

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  }
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 52 of file class.ilCalendarRecurrence.php.

Referenced by getBYDAY().

◆ $bymonth

string ilCalendarRecurrence::$bymonth = ''
private

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

Referenced by getBYMONTH().

◆ $bymonthday

string ilCalendarRecurrence::$bymonthday = ''
private

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

Referenced by getBYMONTHDAY().

◆ $bysetpos

string ilCalendarRecurrence::$bysetpos = ''
private

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

Referenced by getBYSETPOS().

◆ $byweekno

string ilCalendarRecurrence::$byweekno = ''
private

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

Referenced by getBYWEEKNO().

◆ $byyearday

string ilCalendarRecurrence::$byyearday = ''
private

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

Referenced by getBYYEARDAY().

◆ $cal_id

int ilCalendarRecurrence::$cal_id = 0
private

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

Referenced by getEntryId().

◆ $db

ilDBInterface ilCalendarRecurrence::$db
protected

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

◆ $exclusion_dates

array ilCalendarRecurrence::$exclusion_dates = array()
private

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

Referenced by getExclusionDates().

◆ $freq_type

string ilCalendarRecurrence::$freq_type = ''
private

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

Referenced by getFrequenceType().

◆ $freq_until_count

int ilCalendarRecurrence::$freq_until_count = 0
private

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

Referenced by getFrequenceUntilCount().

◆ $freq_until_date

ilDate ilCalendarRecurrence::$freq_until_date = null
private

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

◆ $freq_until_type

string ilCalendarRecurrence::$freq_until_type = ''
private

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

◆ $interval

int ilCalendarRecurrence::$interval = 1
private

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

Referenced by getInterval().

◆ $recurrence_id

int ilCalendarRecurrence::$recurrence_id = 0
private

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

Referenced by getRecurrenceId().

◆ $recurrence_type

int ilCalendarRecurrence::$recurrence_type = 0
private

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

◆ $timezone

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

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

Referenced by getTimeZone().

◆ $weekstart

string ilCalendarRecurrence::$weekstart = ''
private

Definition at line 58 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 32 of file class.ilCalendarRecurrence.php.

◆ REC_RECURRENCE

const ilCalendarRecurrence::REC_RECURRENCE = 0
protected

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


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