ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCalendarRecurrenceExclusion Class Reference

Stores exclusion dates for calendar recurrences. More...

+ Collaboration diagram for ilCalendarRecurrenceExclusion:

Public Member Functions

 __construct ($a_exclusion_id=0)
 Constructor. More...
 
 getId ()
 Get exclusion id. More...
 
 getEntryId ()
 Get calendar entry id. More...
 
 setEntryId ($a_id)
 Set entry id (id of calendar appointment) More...
 
 getDate ()
 Get exclusion date. More...
 
 setDate (ilDate $dt=null)
 Set exclusion date. More...
 
 toICal ()
 Exclusion date to ical format. More...
 
 save ()
 Save exclusion date to db. More...
 

Protected Member Functions

 read ()
 Read exclusion. More...
 

Protected Attributes

 $exclusion = null
 
 $cal_id = 0
 
 $exclusion_id = 0
 
 $db = null
 

Detailed Description

Stores exclusion dates for calendar recurrences.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRecurrenceExclusion::__construct (   $a_exclusion_id = 0)

Constructor.

Returns

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

51 {
52 global $DIC;
53
54 $ilDB = $DIC['ilDB'];
55
56 $this->db = $ilDB;
57 $this->exclusion_id = $a_exclusion_id;
58
59 if ($this->getId()) {
60 $this->read();
61 }
62 }
global $DIC
Definition: goto.php:24
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getDate()

ilCalendarRecurrenceExclusion::getDate ( )

Get exclusion date.

Returns

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

98 {
99 return $this->exclusion instanceof ilDate ? $this->exclusion : null;
100 }
Class for single dates.

Referenced by save(), and toICal().

+ Here is the caller graph for this function:

◆ getEntryId()

ilCalendarRecurrenceExclusion::getEntryId ( )

Get calendar entry id.

Returns

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

References $cal_id.

Referenced by save(), and toICal().

+ Here is the caller graph for this function:

◆ getId()

ilCalendarRecurrenceExclusion::getId ( )

Get exclusion id.

Returns

Definition at line 69 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

Read exclusion.

Returns

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

161 {
162 global $DIC;
163
164 $ilDB = $DIC['ilDB'];
165
166 $query = "SELECT * FROM cal_rec_exclusion WHERE excl_id = " . $ilDB->quote($this->getId(), 'integer');
167 $res = $ilDB->query($query);
168 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
169 $this->cal_id = $row->cal_id;
170 $this->setDate(new ilDate($row->excl_date, IL_CAL_DATE, 'UTC'));
171 }
172 }
const IL_CAL_DATE
setDate(ilDate $dt=null)
Set exclusion date.
$query
foreach($_POST as $key=> $value) $res

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

Referenced by __construct().

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

◆ save()

ilCalendarRecurrenceExclusion::save ( )

Save exclusion date to db.

Returns

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

135 {
136 global $DIC;
137
138 $ilDB = $DIC['ilDB'];
139
140 if (!$this->getDate()) {
141 return false;
142 }
143
144 $query = "INSERT INTO cal_rec_exclusion (excl_id,cal_id,excl_date) " .
145 "VALUES( " .
146 $ilDB->quote($next_id = $ilDB->nextId('cal_rec_exclusion'), 'integer') . ', ' .
147 $ilDB->quote($this->getEntryId(), 'integer') . ', ' .
148 $ilDB->quote($this->getDate()->get(IL_CAL_DATE, '', 'UTC'), 'timestamp') .
149 ')';
150 $ilDB->manipulate($query);
151
152 $this->exclusion_id = $next_id;
153 return $this->getId();
154 }

References $DIC, $ilDB, $query, getDate(), getEntryId(), getId(), and IL_CAL_DATE.

+ Here is the call graph for this function:

◆ setDate()

ilCalendarRecurrenceExclusion::setDate ( ilDate  $dt = null)

Set exclusion date.

Parameters
ilDate$dt[optional]
Returns

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

108 {
109 $this->exclusion = $dt;
110 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrenceExclusion::setEntryId (   $a_id)

Set entry id (id of calendar appointment)

Parameters
object$a_id
Returns

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

89 {
90 $this->cal_id = $a_id;
91 }

◆ toICal()

ilCalendarRecurrenceExclusion::toICal ( )

Exclusion date to ical format.

Returns

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

117 {
118 $entry = new ilCalendarEntry($this->getEntryId());
119 $start = $entry->getStart();
120
121 if ($entry->isFullday()) {
122 return 'EXDATE;VALUE=DATE:' . $this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd');
123 } else {
124 return 'EXDATE:' .
125 $this->getDate()->get(IL_CAL_FKT_DATE, 'Ymd', ilTimeZone::UTC) .
126 'T' . $start->get(IL_CAL_FKT_DATE, 'His', ilTimeZone::UTC) . 'Z';
127 }
128 }
const IL_CAL_FKT_DATE
Model for a calendar entry.

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

+ Here is the call graph for this function:

Field Documentation

◆ $cal_id

ilCalendarRecurrenceExclusion::$cal_id = 0
protected

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

Referenced by getEntryId().

◆ $db

ilCalendarRecurrenceExclusion::$db = null
protected

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

◆ $exclusion

ilCalendarRecurrenceExclusion::$exclusion = null
protected

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

◆ $exclusion_id

ilCalendarRecurrenceExclusion::$exclusion_id = 0
protected

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

Referenced by getId().


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