ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCalendarRecurrenceExclusion Class Reference

Stores exclusion dates for calendar recurrences. More...

+ Collaboration diagram for ilCalendarRecurrenceExclusion:

Public Member Functions

 __construct (int $a_exclusion_id=0)
 
 getId ()
 
 getEntryId ()
 
 setEntryId (int $a_id)
 
 getDate ()
 
 setDate (?ilDate $dt=null)
 Set exclusion date. More...
 
 toICal ()
 
 save ()
 

Protected Member Functions

 read ()
 

Protected Attributes

ilDate $exclusion = null
 
int $cal_id = 0
 
int $exclusion_id = 0
 
ilDBInterface $db
 

Detailed Description

Stores exclusion dates for calendar recurrences.

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

Definition at line 29 of file class.ilCalendarRecurrenceExclusion.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRecurrenceExclusion::__construct ( int  $a_exclusion_id = 0)

Definition at line 37 of file class.ilCalendarRecurrenceExclusion.php.

References $DIC, getId(), and read().

38  {
39  global $DIC;
40 
41  $this->db = $DIC->database();
42  $this->exclusion_id = $a_exclusion_id;
43  if ($this->getId()) {
44  $this->read();
45  }
46  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getDate()

ilCalendarRecurrenceExclusion::getDate ( )

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

Referenced by save(), and toICal().

63  : ?ilDate
64  {
65  return $this->exclusion instanceof ilDate ? $this->exclusion : null;
66  }
+ Here is the caller graph for this function:

◆ getEntryId()

ilCalendarRecurrenceExclusion::getEntryId ( )

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

References $cal_id.

Referenced by toICal().

53  : int
54  {
55  return $this->cal_id;
56  }
+ Here is the caller graph for this function:

◆ getId()

ilCalendarRecurrenceExclusion::getId ( )

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

References $exclusion_id.

Referenced by __construct(), read(), and save().

+ Here is the caller graph for this function:

◆ read()

ilCalendarRecurrenceExclusion::read ( )
protected

Definition at line 108 of file class.ilCalendarRecurrenceExclusion.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, getId(), IL_CAL_DATE, and setDate().

Referenced by __construct().

109  {
110  $query = "SELECT * FROM cal_rec_exclusion WHERE excl_id = " . $this->db->quote($this->getId(), 'integer');
111  $res = $this->db->query($query);
112  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
113  $this->cal_id = $row->cal_id;
114  $this->setDate(new ilDate((string) $row->excl_date, IL_CAL_DATE));
115  }
116  }
$res
Definition: ltiservices.php:69
setDate(?ilDate $dt=null)
Set exclusion date.
$query
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarRecurrenceExclusion::save ( )

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

References $query, getDate(), getId(), and IL_CAL_DATE.

90  : int
91  {
92  if (!$this->getDate()) {
93  return 0;
94  }
95 
96  $query = "INSERT INTO cal_rec_exclusion (excl_id,cal_id,excl_date) " .
97  "VALUES( " .
98  $this->db->quote($next_id = $this->db->nextId('cal_rec_exclusion'), 'integer') . ', ' .
99  $this->db->quote($this->getEntryId(), 'integer') . ', ' .
100  $this->db->quote($this->getDate()->get(IL_CAL_DATE, '', 'UTC'), 'timestamp') .
101  ')';
102  $this->db->manipulate($query);
103 
104  $this->exclusion_id = $next_id;
105  return $this->getId();
106  }
$query
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ setDate()

ilCalendarRecurrenceExclusion::setDate ( ?ilDate  $dt = null)

Set exclusion date.

Definition at line 71 of file class.ilCalendarRecurrenceExclusion.php.

Referenced by read().

71  : void
72  {
73  $this->exclusion = $dt;
74  }
+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrenceExclusion::setEntryId ( int  $a_id)

Definition at line 58 of file class.ilCalendarRecurrenceExclusion.php.

59  {
60  $this->cal_id = $a_id;
61  }

◆ toICal()

ilCalendarRecurrenceExclusion::toICal ( )

Definition at line 76 of file class.ilCalendarRecurrenceExclusion.php.

References getDate(), getEntryId(), IL_CAL_FKT_DATE, and ilTimeZone\UTC.

76  : string
77  {
78  $entry = new ilCalendarEntry($this->getEntryId());
79  $start = $entry->getStart();
80 
81  if ($entry->isFullday()) {
82  return 'EXDATE;VALUE=DATE:' . $this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd');
83  } else {
84  return 'EXDATE:' .
85  $this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd', ilTimeZone::UTC) .
86  'T' . $start->get(IL_CAL_FKT_DATE, 'His', ilTimeZone::UTC) . 'Z';
87  }
88  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_FKT_DATE
+ Here is the call graph for this function:

Field Documentation

◆ $cal_id

int ilCalendarRecurrenceExclusion::$cal_id = 0
protected

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

Referenced by getEntryId().

◆ $db

ilDBInterface ilCalendarRecurrenceExclusion::$db
protected

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

◆ $exclusion

ilDate ilCalendarRecurrenceExclusion::$exclusion = null
protected

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

◆ $exclusion_id

int ilCalendarRecurrenceExclusion::$exclusion_id = 0
protected

Definition at line 33 of file class.ilCalendarRecurrenceExclusion.php.

Referenced by getId().


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