ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCalendarEntry Class Reference

Model for a calendar entry. More...

+ Inheritance diagram for ilCalendarEntry:
+ Collaboration diagram for ilCalendarEntry:

Public Member Functions

 __construct (int $a_id=0)
 
 __clone ()
 clone instance More...
 
 setContextInfo (string $a_info)
 
 getContextInfo ()
 
 getEntryId ()
 
 getLastUpdate ()
 
 setLastUpdate (ilDateTime $a_date)
 
 getStart ()
 Get start of date period. More...
 
 setStart (?ilDateTime $a_start)
 
 getEnd ()
 Get end of period. More...
 
 setEnd (?ilDateTime $a_end)
 
 setTitle (string $a_title)
 
 getTitle ()
 
 getPresentationTitle (bool $a_shorten=true)
 
 getPresentationStyle ()
 
 setSubtitle (string $a_subtitle)
 set subtitle Used for automatic generated appointments. More...
 
 getSubtitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setLocation (string $a_location)
 
 getLocation ()
 
 setFurtherInformations (string $a_informations)
 
 getFurtherInformations ()
 
 setFullday (bool $a_fullday)
 set fullday event Fullday events do not change their time in different timezones. More...
 
 isFullday ()
 is event a fullday period More...
 
 isAutoGenerated ()
 
 setAutoGenerated (bool $a_status)
 
 setContextId (int $a_context_id)
 
 getContextId ()
 
 setTranslationType (int $a_type)
 
 getTranslationType ()
 
 enableNotification (bool $a_status)
 
 isNotificationEnabled ()
 
 update ()
 
 save ()
 
 delete ()
 
 validate ()
 
 appointmentToMailString (ilLanguage $lng)
 

Static Public Member Functions

static _delete (int $a_entry_id)
 

Data Fields

const TRANSLATION_NONE = 0
 
const TRANSLATION_SYSTEM = 1
 

Protected Member Functions

 parseDynamicTitle (string $a_type)
 
 read ()
 

Protected Attributes

ilLogger $log
 
ilDBInterface $db
 
ilLanguage $lng
 
ilErrorHandling $error
 
int $entry_id = 0
 
ilDateTime $last_update = null
 
string $title = ''
 
string $presentation_style = ''
 
string $subtitle = ''
 
string $description = ''
 
string $location = ''
 
string $further_informations = ''
 
ilDateTime $start = null
 
bool $fullday = false
 
ilDateTime $end = null
 
bool $is_auto_generated = false
 
int $context_id = 0
 
string $context_info = ''
 
int $translation_type = ilCalendarEntry::TRANSLATION_NONE
 
bool $notification = false
 

Detailed Description

Model for a calendar entry.

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

Definition at line 27 of file class.ilCalendarEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarEntry::__construct ( int  $a_id = 0)

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

References $DIC, ILIAS\Repository\lng(), and read().

55  {
56  global $DIC;
57 
58  $this->log = $DIC->logger()->cal();
59  $this->lng = $DIC->language();
60  $this->db = $DIC->database();
61  $this->error = $DIC['ilErr'];
62  $this->entry_id = $a_id;
63  if ($this->entry_id > 0) {
64  $this->read();
65  }
66  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilCalendarEntry::__clone ( )

clone instance

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

72  {
73  $this->entry_id = 0;
74  }

◆ _delete()

static ilCalendarEntry::_delete ( int  $a_entry_id)
static

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

References $DIC, $ilDB, $res, and ilCalendarRecurrence\_delete().

Referenced by ilCalendarCategory\delete(), ilCalendarAppEventListener\deleteAppointments(), and ilCalendarRemoteReader\importIcal().

76  : void
77  {
78  global $DIC;
79 
80  $ilDB = $DIC['ilDB'];
81  ilCalendarRecurrence::_delete($a_entry_id);
82 
83  $query = "DELETE FROM cal_entries " .
84  "WHERE cal_id = " . $ilDB->quote($a_entry_id, 'integer') . " ";
85  $res = $ilDB->manipulate($query);
86  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
static _delete(int $a_cal_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appointmentToMailString()

ilCalendarEntry::appointmentToMailString ( ilLanguage  $lng)

Definition at line 445 of file class.ilCalendarEntry.php.

References ilDatePresentation\formatPeriod(), getDescription(), getEnd(), getLocation(), getStart(), getTitle(), ilDatePresentation\setUseRelativeDates(), and ilLanguage\txt().

445  : string
446  {
447  $body = $lng->txt('cal_details');
448  $body .= "\n\n";
449  $body .= $lng->txt('title') . ': ' . $this->getTitle() . "\n";
450 
452  $body .= $lng->txt('date') . ': ' . ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd()) . "\n";
454 
455  if (strlen($this->getLocation())) {
456  $body .= $lng->txt('cal_where') . ': ' . $this->getLocation() . "\n";
457  }
458 
459  if (strlen($this->getDescription())) {
460  $body .= $lng->txt('description') . ': ' . $this->getDescription() . "\n";
461  }
462  return $body;
463  }
static array static setUseRelativeDates(bool $a_status)
set use relative dates
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getEnd()
Get end of period.
getStart()
Get start of date period.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
+ Here is the call graph for this function:

◆ delete()

ilCalendarEntry::delete ( )

Definition at line 389 of file class.ilCalendarEntry.php.

References $res, ilCalendarRecurrence\_delete(), ilCalendarCategoryAssignments\_deleteByAppointmentId(), and getEntryId().

Referenced by ilCalendarAppointmentGUI\delete().

389  : void
390  {
392 
393  $query = "DELETE FROM cal_entries " .
394  "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
395  $res = $this->db->manipulate($query);
396 
398  }
$res
Definition: ltiservices.php:66
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
static _delete(int $a_cal_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enableNotification()

ilCalendarEntry::enableNotification ( bool  $a_status)

Definition at line 318 of file class.ilCalendarEntry.php.

References ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

Referenced by read().

318  : void
319  {
320  $this->notification = $a_status;
321  }
notification()
description: > Example for rendring a notification glyph.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContextId()

◆ getContextInfo()

ilCalendarEntry::getContextInfo ( )

Definition at line 93 of file class.ilCalendarEntry.php.

References $context_info.

Referenced by ilCalendarScheduleFilterTimings\modifyEvent(), save(), and update().

93  : string
94  {
95  return $this->context_info;
96  }
+ Here is the caller graph for this function:

◆ getDescription()

ilCalendarEntry::getDescription ( )

Definition at line 248 of file class.ilCalendarEntry.php.

References $description.

Referenced by appointmentToMailString(), ilCalendarExport\createVEVENT(), save(), and update().

248  : string
249  {
250  return $this->description;
251  }
+ Here is the caller graph for this function:

◆ getEnd()

ilCalendarEntry::getEnd ( )

Get end of period.

Implements ilDatePeriod.

Definition at line 123 of file class.ilCalendarEntry.php.

References $end.

Referenced by appointmentToMailString(), ilCalendarExport\createVEVENT(), ilCalendarScheduleFilterBookingPool\modifyEvent(), save(), update(), and validate().

123  : ?ilDateTime
124  {
125  return $this->end;
126  }
+ Here is the caller graph for this function:

◆ getEntryId()

◆ getFurtherInformations()

ilCalendarEntry::getFurtherInformations ( )

Definition at line 268 of file class.ilCalendarEntry.php.

References $further_informations.

Referenced by save(), and update().

268  : string
269  {
271  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCalendarEntry::getLastUpdate ( )

Definition at line 103 of file class.ilCalendarEntry.php.

References IL_CAL_UNIX.

Referenced by ilCalendarExport\createVEVENT().

103  : ilDateTime
104  {
105  return $this->last_update ?: new ilDateTime(time(), IL_CAL_UNIX);
106  }
const IL_CAL_UNIX
+ Here is the caller graph for this function:

◆ getLocation()

ilCalendarEntry::getLocation ( )

Definition at line 258 of file class.ilCalendarEntry.php.

References $location.

Referenced by appointmentToMailString(), ilCalendarExport\createVEVENT(), save(), and update().

258  : string
259  {
260  return $this->location;
261  }
+ Here is the caller graph for this function:

◆ getPresentationStyle()

ilCalendarEntry::getPresentationStyle ( )

Definition at line 223 of file class.ilCalendarEntry.php.

References $presentation_style.

223  : string
224  {
226  }

◆ getPresentationTitle()

ilCalendarEntry::getPresentationTitle ( bool  $a_shorten = true)

Definition at line 143 of file class.ilCalendarEntry.php.

References $title, getSubtitle(), getTitle(), getTranslationType(), ILIAS\Repository\lng(), parseDynamicTitle(), ilStr\shortenTextExtended(), ilStr\shortenWords(), and TRANSLATION_NONE.

Referenced by ilCalendarExport\createVEVENT(), ilCalendarViewGUI\getAppointmentShyButton(), and ilCalendarScheduleFilterTimings\modifyEvent().

143  : string
144  {
146  $title = $this->getTitle();
147  } elseif (strlen($this->getSubtitle())) {
148  // parse dynamic title?
149  if (preg_match("/#([a-z]+)#/", $this->getSubtitle(), $matches)) {
150  $subtitle = $this->parseDynamicTitle($matches[1]);
151  } else {
152  $subtitle = $this->lng->txt($this->getSubtitle());
153  }
154  $title = $this->getTitle() .
155  (strlen($subtitle)
156  ? ' (' . $subtitle . ')'
157  : '');
158  } else {
159  $title = $this->lng->txt($this->getTitle());
160  }
161 
162  if ($a_shorten) {
164  }
165  return $title;
166  }
parseDynamicTitle(string $a_type)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
static shortenWords(string $a_str, int $a_len=30, bool $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStart()

◆ getSubtitle()

ilCalendarEntry::getSubtitle ( )

Definition at line 238 of file class.ilCalendarEntry.php.

References $subtitle.

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

238  : string
239  {
240  return $this->subtitle;
241  }
+ Here is the caller graph for this function:

◆ getTitle()

ilCalendarEntry::getTitle ( )

Definition at line 138 of file class.ilCalendarEntry.php.

References $title.

Referenced by appointmentToMailString(), getPresentationTitle(), ilCalendarScheduleFilterTimings\modifyEvent(), save(), update(), and validate().

138  : string
139  {
140  return $this->title;
141  }
+ Here is the caller graph for this function:

◆ getTranslationType()

ilCalendarEntry::getTranslationType ( )

Definition at line 313 of file class.ilCalendarEntry.php.

References $translation_type.

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

313  : int
314  {
316  }
+ Here is the caller graph for this function:

◆ isAutoGenerated()

ilCalendarEntry::isAutoGenerated ( )

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

References $is_auto_generated.

Referenced by ilCalendarScheduleFilterTimings\modifyEvent(), save(), and update().

288  : bool
289  {
291  }
+ Here is the caller graph for this function:

◆ isFullday()

ilCalendarEntry::isFullday ( )

is event a fullday period

Implements ilDatePeriod.

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

References $fullday.

Referenced by ilCalendarExport\createVEVENT(), read(), save(), and update().

283  : bool
284  {
285  return $this->fullday;
286  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilCalendarEntry::isNotificationEnabled ( )

Definition at line 323 of file class.ilCalendarEntry.php.

References $notification.

Referenced by save(), and update().

323  : bool
324  {
325  return $this->notification;
326  }
+ Here is the caller graph for this function:

◆ parseDynamicTitle()

ilCalendarEntry::parseDynamicTitle ( string  $a_type)
protected

Definition at line 168 of file class.ilCalendarEntry.php.

References $title, ilConsultationHourAppointments\getAppointmentIds(), getContextId(), getEntryId(), getStart(), and ILIAS\Repository\lng().

Referenced by getPresentationTitle().

168  : string
169  {
170  $title = $style = "";
171  switch ($a_type) {
172  case "consultationhour":
173  $entry = new ilBookingEntry($this->getContextId());
174  if ($entry) {
175  if ($entry->isOwner()) {
176  $max = $entry->getNumberOfBookings();
177  $current = $entry->getCurrentNumberOfBookings($this->getEntryId());
178  $free = (($max - $current) >= 0 ? ($max - $current) : 0);
179  if (!$current) {
180  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
181  $title = $this->lng->txt('cal_book_free');
182  } elseif ($current >= $max) {
183  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
184  $title = $this->lng->txt('cal_booked_out');
185  } else {
186  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
187  $title = sprintf($this->lng->txt('cal_ch_booking_num_free_short'), $free);
188  }
189  } else {
191  $entry->getObjId(),
192  $this->getContextId(),
193  $this->getStart()
194  );
195  if ($apps === []) {
196  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
197  $title = $this->lng->txt('cal_booked_out');
198  } else {
199  $orig_event = $apps[0];
200  $max = $entry->getNumberOfBookings();
201  $current = $entry->getCurrentNumberOfBookings($this->getEntryId());
202  if ($entry->hasBooked($orig_event)) {
203  $title = $this->lng->txt('cal_date_booked');
204  } elseif ($current >= $max) {
205  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
206  $title = $this->lng->txt('cal_booked_out');
207  } else {
208  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
209  $title = $this->lng->txt('cal_book_free');
210  }
211  }
212  }
213  }
214  break;
215  }
216  if (strlen($style)) {
217  $this->presentation_style = $style;
218  }
219 
220  return $title;
221  }
static getAppointmentIds(int $a_user_id, ?int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
getStart()
Get start of date period.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilCalendarEntry::read ( )
protected

Definition at line 417 of file class.ilCalendarEntry.php.

References $res, enableNotification(), ilDBConstants\FETCHMODE_OBJECT, getEntryId(), IL_CAL_DATETIME, isFullday(), setAutoGenerated(), setContextId(), setContextInfo(), setDescription(), setFullday(), setFurtherInformations(), setLastUpdate(), setLocation(), setSubtitle(), setTitle(), and setTranslationType().

Referenced by __construct().

417  : void
418  {
419  $query = "SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
420  $res = $this->db->query($query);
421  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
422  $this->setLastUpdate(new ilDateTime((string) $row->last_update, IL_CAL_DATETIME, 'UTC'));
423  $this->setTitle((string) $row->title);
424  $this->setSubtitle((string) $row->subtitle);
425  $this->setDescription((string) $row->description);
426  $this->setLocation((string) $row->location);
427  $this->setFurtherInformations((string) $row->informations);
428  $this->setFullday((bool) $row->fullday);
429  $this->setAutoGenerated((bool) $row->auto_generated);
430  $this->setContextId((int) $row->context_id);
431  $this->setContextInfo((string) $row->context_info);
432  $this->setTranslationType((int) $row->translation_type);
433  $this->enableNotification((bool) $row->notification);
434 
435  if ($this->isFullday()) {
436  $this->start = new ilDate((string) $row->starta, IL_CAL_DATETIME);
437  $this->end = new ilDate((string) $row->enda, IL_CAL_DATETIME);
438  } else {
439  $this->start = new ilDateTime((string) $row->starta, IL_CAL_DATETIME, 'UTC');
440  $this->end = new ilDateTime((string) $row->enda, IL_CAL_DATETIME, 'UTC');
441  }
442  }
443  }
$res
Definition: ltiservices.php:66
setTitle(string $a_title)
const IL_CAL_DATETIME
setAutoGenerated(bool $a_status)
setContextId(int $a_context_id)
setSubtitle(string $a_subtitle)
set subtitle Used for automatic generated appointments.
setLocation(string $a_location)
setFullday(bool $a_fullday)
set fullday event Fullday events do not change their time in different timezones. ...
setFurtherInformations(string $a_informations)
isFullday()
is event a fullday period
setTranslationType(int $a_type)
setContextInfo(string $a_info)
enableNotification(bool $a_status)
setLastUpdate(ilDateTime $a_date)
setDescription(string $a_description)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarEntry::save ( )

Definition at line 355 of file class.ilCalendarEntry.php.

References $res, getContextId(), getContextInfo(), getDescription(), getEnd(), getFurtherInformations(), getLocation(), getStart(), getSubtitle(), getTitle(), getTranslationType(), IL_CAL_DATETIME, IL_CAL_UNIX, isAutoGenerated(), isFullday(), isNotificationEnabled(), and ilTimeZone\UTC.

355  : void
356  {
357  $next_id = $this->db->nextId('cal_entries');
358  $now = new ilDateTime(time(), IL_CAL_UNIX);
359  $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
360 
361  $query = "INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, " .
362  "informations,auto_generated,context_id,context_info,translation_type, notification) " .
363  "VALUES( " .
364  $this->db->quote($next_id, 'integer') . ", " .
365  /*
366  * The title needs to be truncated to fit into the table column. This is a pretty
367  * brute force method for doing so, but right now I can't find a better place for it.
368  */
369  $this->db->quote(substr($this->getTitle(), 0, 128), 'text') . ", " .
370  $this->db->quote($utc_timestamp, 'timestamp') . ", " .
371  $this->db->quote($this->getSubtitle(), 'text') . ", " .
372  $this->db->quote($this->getDescription(), 'text') . ", " .
373  $this->db->quote($this->getLocation(), 'text') . ", " .
374  $this->db->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
375  $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
376  $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
377  $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
378  $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
379  $this->db->quote($this->getContextId(), 'integer') . ", " .
380  $this->db->quote($this->getContextInfo(), 'text') . ', ' .
381  $this->db->quote($this->getTranslationType(), 'integer') . ", " .
382  $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
383  ")";
384  $res = $this->db->manipulate($query);
385 
386  $this->entry_id = $next_id;
387  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
const IL_CAL_UNIX
getEnd()
Get end of period.
isFullday()
is event a fullday period
getStart()
Get start of date period.
+ Here is the call graph for this function:

◆ setAutoGenerated()

ilCalendarEntry::setAutoGenerated ( bool  $a_status)

Definition at line 293 of file class.ilCalendarEntry.php.

Referenced by read().

293  : void
294  {
295  $this->is_auto_generated = $a_status;
296  }
+ Here is the caller graph for this function:

◆ setContextId()

ilCalendarEntry::setContextId ( int  $a_context_id)

Definition at line 298 of file class.ilCalendarEntry.php.

Referenced by read().

298  : void
299  {
300  $this->context_id = $a_context_id;
301  }
+ Here is the caller graph for this function:

◆ setContextInfo()

ilCalendarEntry::setContextInfo ( string  $a_info)

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

Referenced by read().

88  : void
89  {
90  $this->context_info = $a_info;
91  }
+ Here is the caller graph for this function:

◆ setDescription()

ilCalendarEntry::setDescription ( string  $a_description)

Definition at line 243 of file class.ilCalendarEntry.php.

Referenced by read().

243  : void
244  {
245  $this->description = $a_description;
246  }
+ Here is the caller graph for this function:

◆ setEnd()

ilCalendarEntry::setEnd ( ?ilDateTime  $a_end)

Definition at line 128 of file class.ilCalendarEntry.php.

Referenced by ilCalendarScheduleFilterBookingPool\modifyEvent().

128  : void
129  {
130  $this->end = $a_end;
131  }
+ Here is the caller graph for this function:

◆ setFullday()

ilCalendarEntry::setFullday ( bool  $a_fullday)

set fullday event Fullday events do not change their time in different timezones.

It is possible to create fullday events with a duration of more than one day.

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

Referenced by read().

278  : void
279  {
280  $this->fullday = $a_fullday;
281  }
+ Here is the caller graph for this function:

◆ setFurtherInformations()

ilCalendarEntry::setFurtherInformations ( string  $a_informations)

Definition at line 263 of file class.ilCalendarEntry.php.

Referenced by read().

263  : void
264  {
265  $this->further_informations = $a_informations;
266  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCalendarEntry::setLastUpdate ( ilDateTime  $a_date)

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

Referenced by read().

108  : void
109  {
110  $this->last_update = $a_date;
111  }
+ Here is the caller graph for this function:

◆ setLocation()

ilCalendarEntry::setLocation ( string  $a_location)

Definition at line 253 of file class.ilCalendarEntry.php.

Referenced by read().

253  : void
254  {
255  $this->location = $a_location;
256  }
+ Here is the caller graph for this function:

◆ setStart()

ilCalendarEntry::setStart ( ?ilDateTime  $a_start)

Definition at line 118 of file class.ilCalendarEntry.php.

118  : void
119  {
120  $this->start = $a_start;
121  }

◆ setSubtitle()

ilCalendarEntry::setSubtitle ( string  $a_subtitle)

set subtitle Used for automatic generated appointments.

Will be appended to the title.

Definition at line 233 of file class.ilCalendarEntry.php.

Referenced by read().

233  : void
234  {
235  $this->subtitle = $a_subtitle;
236  }
+ Here is the caller graph for this function:

◆ setTitle()

ilCalendarEntry::setTitle ( string  $a_title)

Definition at line 133 of file class.ilCalendarEntry.php.

Referenced by ilCalendarScheduleFilterTimings\modifyEvent(), and read().

133  : void
134  {
135  $this->title = $a_title;
136  }
+ Here is the caller graph for this function:

◆ setTranslationType()

ilCalendarEntry::setTranslationType ( int  $a_type)

Definition at line 308 of file class.ilCalendarEntry.php.

Referenced by read().

308  : void
309  {
310  $this->translation_type = $a_type;
311  }
+ Here is the caller graph for this function:

◆ update()

ilCalendarEntry::update ( )

Definition at line 328 of file class.ilCalendarEntry.php.

References $res, getContextId(), getContextInfo(), getDescription(), getEnd(), getEntryId(), getFurtherInformations(), getLocation(), getStart(), getSubtitle(), getTitle(), getTranslationType(), IL_CAL_DATETIME, IL_CAL_UNIX, isAutoGenerated(), isFullday(), isNotificationEnabled(), and ilTimeZone\UTC.

328  : void
329  {
330  $now = new ilDateTime(time(), IL_CAL_UNIX);
331  $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
332  $query = "UPDATE cal_entries " .
333  /*
334  * The title needs to be truncated to fit into the table column. This is a pretty
335  * brute force method for doing so, but right now I can't find a better place for it.
336  */
337  "SET title = " . $this->db->quote(substr($this->getTitle(), 0, 128), 'text') . ", " .
338  "last_update = " . $this->db->quote($utc_timestamp, 'timestamp') . ", " .
339  "subtitle = " . $this->db->quote($this->getSubtitle(), 'text') . ", " .
340  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
341  "location = " . $this->db->quote($this->getLocation(), 'text') . ", " .
342  "fullday = " . $this->db->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
343  "starta = " . $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
344  "enda = " . $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
345  "informations = " . $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
346  "auto_generated = " . $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
347  "translation_type = " . $this->db->quote($this->getTranslationType(), 'integer') . ", " .
348  "context_id = " . $this->db->quote($this->getContextId(), 'integer') . ", " .
349  'context_info = ' . $this->db->quote($this->getContextInfo(), 'text') . ', ' .
350  'notification = ' . $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
351  "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
352  $res = $this->db->manipulate($query);
353  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
const IL_CAL_UNIX
getEnd()
Get end of period.
isFullday()
is event a fullday period
getStart()
Get start of date period.
+ Here is the call graph for this function:

◆ validate()

ilCalendarEntry::validate ( )

Definition at line 400 of file class.ilCalendarEntry.php.

References ilDateTime\_before(), getEnd(), getStart(), getTitle(), and ILIAS\Repository\lng().

400  : bool
401  {
402  $success = true;
403  $this->error->setMessage('');
404  if (!strlen($this->getTitle())) {
405  $success = false;
406  $this->error->appendMessage($this->lng->txt('err_missing_title'));
407  }
408  if (!$this->getStart() || !$this->getEnd()) {
409  $success = false;
410  } elseif (ilDateTime::_before($this->getEnd(), $this->getStart(), '')) {
411  $success = false;
412  $this->error->appendMessage($this->lng->txt('err_end_before_start'));
413  }
414  return $success;
415  }
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
getEnd()
Get end of period.
getStart()
Get start of date period.
+ Here is the call graph for this function:

Field Documentation

◆ $context_id

int ilCalendarEntry::$context_id = 0
protected

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

Referenced by getContextId().

◆ $context_info

string ilCalendarEntry::$context_info = ''
protected

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

Referenced by getContextInfo().

◆ $db

ilDBInterface ilCalendarEntry::$db
protected

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

◆ $description

string ilCalendarEntry::$description = ''
protected

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

Referenced by getDescription().

◆ $end

ilDateTime ilCalendarEntry::$end = null
protected

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

Referenced by getEnd().

◆ $entry_id

int ilCalendarEntry::$entry_id = 0
protected

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

Referenced by getEntryId().

◆ $error

ilErrorHandling ilCalendarEntry::$error
protected

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

◆ $fullday

bool ilCalendarEntry::$fullday = false
protected

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

Referenced by isFullday().

◆ $further_informations

string ilCalendarEntry::$further_informations = ''
protected

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

Referenced by getFurtherInformations().

◆ $is_auto_generated

bool ilCalendarEntry::$is_auto_generated = false
protected

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

Referenced by isAutoGenerated().

◆ $last_update

ilDateTime ilCalendarEntry::$last_update = null
protected

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

◆ $lng

ilLanguage ilCalendarEntry::$lng
protected

Definition at line 34 of file class.ilCalendarEntry.php.

◆ $location

string ilCalendarEntry::$location = ''
protected

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

Referenced by getLocation().

◆ $log

ilLogger ilCalendarEntry::$log
protected

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

◆ $notification

bool ilCalendarEntry::$notification = false
protected

Definition at line 52 of file class.ilCalendarEntry.php.

Referenced by isNotificationEnabled().

◆ $presentation_style

string ilCalendarEntry::$presentation_style = ''
protected

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

Referenced by getPresentationStyle().

◆ $start

ilDateTime ilCalendarEntry::$start = null
protected

Definition at line 45 of file class.ilCalendarEntry.php.

Referenced by getStart().

◆ $subtitle

string ilCalendarEntry::$subtitle = ''
protected

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

Referenced by getSubtitle().

◆ $title

string ilCalendarEntry::$title = ''
protected

Definition at line 39 of file class.ilCalendarEntry.php.

Referenced by getPresentationTitle(), getTitle(), and parseDynamicTitle().

◆ $translation_type

int ilCalendarEntry::$translation_type = ilCalendarEntry::TRANSLATION_NONE
protected

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

Referenced by getTranslationType().

◆ TRANSLATION_NONE

const ilCalendarEntry::TRANSLATION_NONE = 0

◆ TRANSLATION_SYSTEM


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