ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->read();
59  }
60  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ getDate()

ilCalendarRecurrenceExclusion::getDate ( )

Get exclusion date.

Returns

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

Referenced by save(), and toICal().

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

◆ getEntryId()

ilCalendarRecurrenceExclusion::getEntryId ( )

Get calendar entry id.

Returns

Definition at line 76 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 67 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 156 of file class.ilCalendarRecurrenceExclusion.php.

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

Referenced by __construct().

157  {
158  global $ilDB;
159 
160  $query = "SELECT * FROM cal_rec_exclusion WHERE excl_id = " . $ilDB->quote($this->getId(), 'integer');
161  $res = $ilDB->query($query);
162  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163  $this->cal_id = $row->cal_id;
164  $this->setDate(new ilDate($row->excl_date, IL_CAL_DATE, 'UTC'));
165  }
166  }
setDate(ilDate $dt=null)
Set exclusion date.
Class for single dates.
foreach($_POST as $key=> $value) $res
$query
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 132 of file class.ilCalendarRecurrenceExclusion.php.

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

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

Referenced by read().

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

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

◆ toICal()

ilCalendarRecurrenceExclusion::toICal ( )

Exclusion date to ical format.

Returns

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

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

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