ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

51  {
52  global $ilDB;
53 
54  $this->db = $ilDB;
55  $this->exclusion_id = $a_exclusion_id;
56 
57  if($this->getId())
58  {
59  $this->read();
60  }
61  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ getDate()

ilCalendarRecurrenceExclusion::getDate ( )

Get exclusion date.

Returns

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

Referenced by save(), and toICal().

97  {
98  return $this->exclusion instanceof ilDate ? $this->exclusion : null;
99  }
Class for single dates.
+ Here is the caller graph for this function:

◆ getEntryId()

ilCalendarRecurrenceExclusion::getEntryId ( )

Get calendar entry id.

Returns

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

References $cal_id.

Referenced by toICal().

+ Here is the caller graph for this function:

◆ getId()

ilCalendarRecurrenceExclusion::getId ( )

Get exclusion id.

Returns

Definition at line 68 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 161 of file class.ilCalendarRecurrenceExclusion.php.

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

Referenced by __construct().

162  {
163  global $ilDB;
164 
165  $query = "SELECT * FROM cal_rec_exclusion WHERE excl_id = ".$ilDB->quote($this->getId(),'integer');
166  $res = $ilDB->query($query);
167  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
168  {
169  $this->cal_id = $row->cal_id;
170  $this->setDate(new ilDate($row->excl_date,IL_CAL_DATE,'UTC'));
171  }
172  }
setDate(ilDate $dt=NULL)
Set exclusion date.
Class for single dates.
const IL_CAL_DATE
global $ilDB
+ 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 136 of file class.ilCalendarRecurrenceExclusion.php.

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

137  {
138  global $ilDB;
139 
140  if(!$this->getDate())
141  {
142  return false;
143  }
144 
145  $query = "INSERT INTO cal_rec_exclusion (excl_id,cal_id,excl_date) ".
146  "VALUES( ".
147  $ilDB->quote($next_id = $ilDB->nextId('cal_rec_exclusion'),'integer').', '.
148  $ilDB->quote($this->getEntryId(),'integer').', '.
149  $ilDB->quote($this->getDate()->get(IL_CAL_DATE,'','UTC'),'timestamp').
150  ')';
151  $ilDB->manipulate($query);
152 
153  $this->exclusion_id = $next_id;
154  return $this->getId();
155  }
const IL_CAL_DATE
global $ilDB
+ 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 106 of file class.ilCalendarRecurrenceExclusion.php.

Referenced by read().

107  {
108  $this->exclusion = $dt;
109  }
+ 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 87 of file class.ilCalendarRecurrenceExclusion.php.

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

◆ toICal()

ilCalendarRecurrenceExclusion::toICal ( )

Exclusion date to ical format.

Returns

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

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

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