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

Model for a calendar entry. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 __clone ()
 clone instance More...
 
 setContextInfo ($a_info)
 Set context info. More...
 
 getContextInfo ()
 
 getEntryId ()
 get entry id More...
 
 getLastUpdate ()
 get last update More...
 
 setLastUpdate ($a_date)
 set last update More...
 
 getStart ()
 get start More...
 
 setStart ($a_start)
 @access public More...
 
 getEnd ()
 get end @access public More...
 
 setEnd ($a_end)
 set end @access public More...
 
 setTitle ($a_title)
 set title More...
 
 getTitle ()
 get title More...
 
 getPresentationTitle ($a_shorten=true)
 get title for presentation. More...
 
 getPresentationStyle ()
 
 setSubtitle ($a_subtitle)
 set subtitle Used for automatic generated appointments. More...
 
 getSubtitle ()
 get subtitle More...
 
 setDescription ($a_description)
 set description More...
 
 getDescription ()
 get description More...
 
 setLocation ($a_location)
 set location More...
 
 getLocation ()
 get location More...
 
 setFurtherInformations ($a_informations)
 set further informations More...
 
 getFurtherInformations ()
 get further informations More...
 
 setFullday ($a_fullday)
 set fullday event Fullday events do not change their time in different timezones. More...
 
 isFullday ()
 is fullday More...
 
 isAutoGenerated ()
 is auto generated More...
 
 setAutoGenerated ($a_status)
 set auto generated More...
 
 isMilestone ()
 is milestone More...
 
 setMilestone ($a_status)
 set milestone More...
 
 setCompletion ($a_completion)
 Set Completion. More...
 
 getCompletion ()
 Get Completion. More...
 
 setContextId ($a_context_id)
 set context id More...
 
 getContextId ()
 get context id More...
 
 setTranslationType ($a_type)
 @access public More...
 
 getTranslationType ()
 get translation type More...
 
 enableNotification ($a_status)
 Enable course group notification. More...
 
 isNotificationEnabled ()
 Check if course group notification is enabled. More...
 
 update ()
 update More...
 
 save ()
 save one entry More...
 
 delete ()
 delete More...
 
 validate ()
 validate More...
 
 appointmentToMailString ($lng)
 
 writeResponsibleUsers ($a_users)
 Write users responsible for a milestone. More...
 
 readResponsibleUsers ()
 Read responsible users. More...
 
 isFullday ()
 is fullday More...
 

Static Public Member Functions

static _delete ($a_entry_id)
 delete entry More...
 
 getStart ()
 Interface method get start. More...
 
 getEnd ()
 Interface method get end. More...
 

Protected Member Functions

 parseDynamicTitle ($a_type)
 
 read ()
 @access protected More...
 

Protected Attributes

 $log
 
 $db
 
 $entry_id
 
 $last_update
 
 $title
 
 $subtitle
 
 $description
 
 $location
 
 $further_informations
 
 $start = null
 
 $fullday
 
 $end = null
 
 $is_auto_generated = false
 
 $context_id = 0
 
 $context_info = ''
 
 $translation_type = IL_CAL_TRANSLATION_NONE
 
 $is_milestone = false
 
 $completion = 0
 
 $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 20 of file class.ilCalendarEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarEntry::__construct (   $a_id = 0)

Constructor.

@access public

Parameters
intcal_entry id

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

53 {
54 global $DIC;
55
56 $ilDB = $DIC['ilDB'];
57 $this->log = $DIC->logger()->cal();
58
59 $this->db = $ilDB;
60
61 if ($this->entry_id = $a_id) {
62 $this->read();
63 }
64 }
read()
@access protected
global $DIC
Definition: goto.php:24
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilCalendarEntry::__clone ( )

clone instance

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

70 {
71 $this->entry_id = null;
72 }

◆ _delete()

static ilCalendarEntry::_delete (   $a_entry_id)
static

delete entry

@access public

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

82 {
83 global $DIC;
84
85 $ilDB = $DIC['ilDB'];
86
87 include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
89
90 $query = "DELETE FROM cal_entries " .
91 "WHERE cal_id = " . $ilDB->quote($a_entry_id, 'integer') . " ";
92 $res = $ilDB->manipulate($query);
93
94 return true;
95 }
static _delete($a_cal_id)
delete
$query
foreach($_POST as $key=> $value) $res

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

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

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

◆ appointmentToMailString()

ilCalendarEntry::appointmentToMailString (   $lng)
Parameters
ilLanguage$lng
Returns

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

740 {
741 $body = $lng->txt('cal_details');
742 $body .= "\n\n";
743 $body .= $lng->txt('title') . ': ' . $this->getTitle() . "\n";
744
746 $body .= $lng->txt('date') . ': ' . ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd()) . "\n";
748
749 if (strlen($this->getLocation())) {
750 $body .= $lng->txt('cal_where') . ': ' . $this->getLocation() . "\n";
751 }
752
753 if (strlen($this->getDescription())) {
754 $body .= $lng->txt('description') . ': ' . $this->getDescription() . "\n";
755 }
756 return $body;
757 }
getEnd()
get end @access public
getDescription()
get description
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$lng

References $lng, ilDatePresentation\formatPeriod(), getDescription(), getEnd(), getLocation(), getStart(), getTitle(), and ilDatePresentation\setUseRelativeDates().

+ Here is the call graph for this function:

◆ delete()

ilCalendarEntry::delete ( )

delete

@access public

Returns

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

647 {
648 global $DIC;
649
650 $ilDB = $DIC['ilDB'];
651
652 include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
654
655 $query = "DELETE FROM cal_entries " .
656 "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
657 $res = $ilDB->manipulate($query);
658
659 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
661
662 return true;
663 }
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.

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

+ Here is the call graph for this function:

◆ enableNotification()

ilCalendarEntry::enableNotification (   $a_status)

Enable course group notification.

Parameters
bool$a_status

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

545 {
546 $this->notification = $a_status;
547 }
notification()
Definition: notification.php:2

References notification().

Referenced by read().

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

◆ getCompletion()

ilCalendarEntry::getCompletion ( )

Get Completion.

Returns
int Completion

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

490 {
491 return $this->completion;
492 }

References $completion.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getContextId()

ilCalendarEntry::getContextId ( )

◆ getContextInfo()

ilCalendarEntry::getContextInfo ( )
Returns
string

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

110 {
111 return $this->context_info;
112 }

References $context_info.

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

+ Here is the caller graph for this function:

◆ getDescription()

ilCalendarEntry::getDescription ( )

get description

@access public

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

354 {
355 return $this->description;
356 }

References $description.

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

+ Here is the caller graph for this function:

◆ getEnd()

ilCalendarEntry::getEnd ( )

get end @access public

Returns
ilDateTime end

Implements ilDatePeriod.

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

178 {
179 return $this->end;
180 }

References $end.

Referenced by appointmentToMailString(), ilCalendarWeekGUI\getAppointmentTimeString(), ilCalendarScheduleFilterBookingPool\modifyEvent(), save(), update(), and validate().

+ Here is the caller graph for this function:

◆ getEntryId()

◆ getFurtherInformations()

ilCalendarEntry::getFurtherInformations ( )

get further informations

@access public

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

References $further_informations.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCalendarEntry::getLastUpdate ( )

get last update

@access public

Parameters

return

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

133 {
134 return $this->last_update ? $this->last_update : new ilDateTime(time(), IL_CAL_UNIX);
135 }
const IL_CAL_UNIX
@classDescription Date and time handling

References IL_CAL_UNIX.

◆ getLocation()

ilCalendarEntry::getLocation ( )

get location

@access public

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

376 {
377 return $this->location;
378 }

References $location.

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

+ Here is the caller graph for this function:

◆ getPresentationStyle()

ilCalendarEntry::getPresentationStyle ( )

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

252 {
253 // see parseDynamicTitle()
254 return $this->presentation_style;
255 }

◆ getPresentationTitle()

ilCalendarEntry::getPresentationTitle (   $a_shorten = true)

get title for presentation.

Special handling for auto generated appointments

@access public

Returns

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

223 {
224 global $DIC;
225
226 $lng = $DIC['lng'];
227
229 $title = $this->getTitle();
230 } elseif (strlen($this->getSubtitle())) {
231 // parse dynamic title?
232 if (preg_match("/#([a-z]+)#/", $this->getSubtitle(), $matches)) {
233 $subtitle = $this->parseDynamicTitle($matches[1]);
234 } else {
235 $subtitle = $lng->txt($this->getSubtitle());
236 }
237 $title = $this->getTitle() .
238 (strlen($subtitle)
239 ? ' (' . $subtitle . ')'
240 : '');
241 } else {
242 $title = $lng->txt($this->getTitle());
243 }
244
245 if ($a_shorten) {
246 return ilUtil::shortenText(ilUtil::shortenWords($title, 20), 40, true);
247 }
248 return $title;
249 }
const IL_CAL_TRANSLATION_NONE
getTranslationType()
get translation type
static shortenWords($a_str, $a_len=30, $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.

References $DIC, $lng, $subtitle, $title, getSubtitle(), getTitle(), getTranslationType(), IL_CAL_TRANSLATION_NONE, parseDynamicTitle(), ilUtil\shortenText(), and ilUtil\shortenWords().

Referenced by ilCalendarScheduleFilterTimings\modifyEvent().

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

◆ getStart()

ilCalendarEntry::getStart ( )

get start

@access public

Returns

Implements ilDatePeriod.

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

157 {
158 return $this->start;
159 }

References $start.

Referenced by appointmentToMailString(), ilCalendarWeekGUI\getAppointmentTimeString(), save(), update(), and validate().

+ Here is the caller graph for this function:

◆ getSubtitle()

ilCalendarEntry::getSubtitle ( )

get subtitle

@access public

Returns

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

332 {
333 return $this->subtitle;
334 }

References $subtitle.

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

+ Here is the caller graph for this function:

◆ getTitle()

ilCalendarEntry::getTitle ( )

get title

@access public

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

211 {
212 return $this->title;
213 }

References $title.

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

+ Here is the caller graph for this function:

◆ getTranslationType()

ilCalendarEntry::getTranslationType ( )

get translation type

@access public

Returns
int translation type

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

536 {
538 }

References $translation_type.

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

+ Here is the caller graph for this function:

◆ isAutoGenerated()

ilCalendarEntry::isAutoGenerated ( )

is auto generated

@access public

Parameters

return

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

434 {
435 return (bool) $this->is_auto_generated;
436 }

References $is_auto_generated.

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

+ Here is the caller graph for this function:

◆ isFullday()

ilCalendarEntry::isFullday ( )

is fullday

@access public

Implements ilDatePeriod.

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

422 {
423 return (bool) $this->fullday;
424 }

References $fullday.

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

+ Here is the caller graph for this function:

◆ isMilestone()

ilCalendarEntry::isMilestone ( )

is milestone

@access public

Parameters

return

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

458 {
459 return (bool) $this->is_milestone;
460 }

References $is_milestone.

Referenced by ilCalendarExport\createAppointment(), save(), and update().

+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilCalendarEntry::isNotificationEnabled ( )

Check if course group notification is enabled.

Returns
bool

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

554 {
555 return (bool) $this->notification;
556 }

References $notification.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ parseDynamicTitle()

ilCalendarEntry::parseDynamicTitle (   $a_type)
protected

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

258 {
259 global $DIC;
260
261 $lng = $DIC['lng'];
262
263 $title = $style = "";
264 switch ($a_type) {
265 case "consultationhour":
266 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
267 $entry = new ilBookingEntry($this->getContextId());
268 if ($entry) {
269 if ($entry->isOwner()) {
270 $max = (int) $entry->getNumberOfBookings();
271 $current = (int) $entry->getCurrentNumberOfBookings($this->getEntryId());
272 if (!$current) {
273 $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
274 $title = $lng->txt('cal_book_free');
275 } elseif ($current >= $max) {
276 $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
277 $title = $lng->txt('cal_booked_out');
278 } else {
279 $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
280 $title = $current . '/' . $max;
281 }
282 } else {
284 $entry->getObjId(),
285 $this->getContextId(),
286 $this->getStart()
287 );
288 $orig_event = $apps[0];
289 $max = $entry->getNumberOfBookings();
290 $current = $entry->getCurrentNumberOfBookings($this->getEntryId());
291 if ($entry->hasBooked($orig_event)) {
292 $title = $lng->txt('cal_date_booked');
293 } elseif ($current >= $max) {
294 $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
295 $title = $lng->txt('cal_booked_out');
296 } else {
297 $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
298 $title = $lng->txt('cal_book_free');
299 }
300 }
301 }
302 break;
303 }
304
305 if ($style) {
306 $this->presentation_style = $style;
307 }
308 return $title;
309 }
Booking definition.
getContextId()
get context id
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.

References $DIC, $lng, $title, ilConsultationHourAppointments\getAppointmentIds(), getContextId(), and getEntryId().

Referenced by getPresentationTitle().

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

◆ read()

ilCalendarEntry::read ( )
protected

@access protected

Parameters

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

701 {
702 global $DIC;
703
704 $ilDB = $DIC['ilDB'];
705
706 $query = "SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
707 $res = $this->db->query($query);
708 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
709 $this->setLastUpdate(new ilDateTime($row->last_update, IL_CAL_DATETIME, 'UTC'));
710 $this->setTitle($row->title);
711 $this->setSubtitle($row->subtitle);
712 $this->setDescription($row->description);
713 $this->setLocation($row->location);
714 $this->setFurtherInformations($row->informations);
715 $this->setFullday((bool) $row->fullday);
716 $this->setAutoGenerated($row->auto_generated);
717 $this->setContextId($row->context_id);
718 $this->setContextInfo($row->context_info);
719 $this->setTranslationType($row->translation_type);
720 $this->setCompletion($row->completion);
721 $this->setMilestone($row->is_milestone);
722 $this->enableNotification((bool) $row->notification);
723
724 if ($this->isFullday()) {
725 $this->start = new ilDate($row->starta, IL_CAL_DATETIME);
726 $this->end = new ilDate($row->enda, IL_CAL_DATETIME);
727 } else {
728 $this->start = new ilDateTime($row->starta, IL_CAL_DATETIME, 'UTC');
729 $this->end = new ilDateTime($row->enda, IL_CAL_DATETIME, 'UTC');
730 }
731 }
732 }
const IL_CAL_DATETIME
setTranslationType($a_type)
@access public
enableNotification($a_status)
Enable course group notification.
setLastUpdate($a_date)
set last update
setAutoGenerated($a_status)
set auto generated
setFullday($a_fullday)
set fullday event Fullday events do not change their time in different timezones.
setLocation($a_location)
set location
setTitle($a_title)
set title
setCompletion($a_completion)
Set Completion.
setFurtherInformations($a_informations)
set further informations
setMilestone($a_status)
set milestone
setContextId($a_context_id)
set context id
setContextInfo($a_info)
Set context info.
setSubtitle($a_subtitle)
set subtitle Used for automatic generated appointments.
setDescription($a_description)
set description
Class for single dates.

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

Referenced by __construct().

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

◆ readResponsibleUsers()

ilCalendarEntry::readResponsibleUsers ( )

Read responsible users.

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

793 {
794 global $DIC;
795
796 $ilDB = $DIC['ilDB'];
797
798 $set = $ilDB->queryF(
799 "SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
800 array("integer"),
801 array($this->getEntryId())
802 );
803
804 $return = array();
805 while ($rec = $ilDB->fetchAssoc($set)) {
806 $n = ilObjUser::_lookupName($rec["user_id"]);
807 $return[] = array_merge(
808 $n,
809 array("login" => ilObjUser::_lookupLogin($rec["user_id"]))
810 );
811 }
812
813 return $return;
814 }
$n
Definition: RandomTest.php:85
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name

References $DIC, $ilDB, $n, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), and getEntryId().

+ Here is the call graph for this function:

◆ save()

ilCalendarEntry::save ( )

save one entry

@access public

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

604 {
605 global $DIC;
606
607 $ilDB = $DIC['ilDB'];
608
609 $next_id = $ilDB->nextId('cal_entries');
610 $now = new ilDateTime(time(), IL_CAL_UNIX);
611 $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
612
613 $query = "INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, " .
614 "informations,auto_generated,context_id,context_info,translation_type, completion, is_milestone, notification) " .
615 "VALUES( " .
616 $ilDB->quote($next_id, 'integer') . ", " .
617 $this->db->quote($this->getTitle(), 'text') . ", " .
618 $ilDB->quote($utc_timestamp, 'timestamp') . ", " .
619 $this->db->quote($this->getSubtitle(), 'text') . ", " .
620 $this->db->quote($this->getDescription(), 'text') . ", " .
621 $this->db->quote($this->getLocation(), 'text') . ", " .
622 $ilDB->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
623 $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
624 $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
625 $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
626 $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
627 $this->db->quote($this->getContextId(), 'integer') . ", " .
628 $this->db->quote($this->getContextInfo(), 'text') . ', ' .
629 $this->db->quote($this->getTranslationType(), 'integer') . ", " .
630 $this->db->quote($this->getCompletion(), 'integer') . ", " .
631 $this->db->quote($this->isMilestone() ? 1 : 0, 'integer') . ", " .
632 $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
633 ")";
634 $res = $ilDB->manipulate($query);
635
636 $this->entry_id = $next_id;
637 return true;
638 }
getCompletion()
Get Completion.
isAutoGenerated()
is auto generated
isNotificationEnabled()
Check if course group notification is enabled.
getFurtherInformations()
get further informations

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

+ Here is the call graph for this function:

◆ setAutoGenerated()

ilCalendarEntry::setAutoGenerated (   $a_status)

set auto generated

@access public

Parameters

return

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

446 {
447 $this->is_auto_generated = $a_status;
448 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCompletion()

ilCalendarEntry::setCompletion (   $a_completion)

Set Completion.

Parameters
int$a_completionCompletion

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

480 {
481 $this->completion = $a_completion;
482 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextId()

ilCalendarEntry::setContextId (   $a_context_id)

set context id

@access public

Parameters
intcontext id
Returns

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

502 {
503 $this->context_id = $a_context_id;
504 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setContextInfo()

ilCalendarEntry::setContextInfo (   $a_info)

Set context info.

Parameters
$a_info

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

102 {
103 $this->context_info = $a_info;
104 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilCalendarEntry::setDescription (   $a_description)

set description

@access public

Parameters
stringdescription

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

344 {
345 $this->description = $a_description;
346 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEnd()

ilCalendarEntry::setEnd (   $a_end)

set end @access public

Parameters

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

188 {
189 $this->end = $a_end;
190 }

Referenced by ilCalendarScheduleFilterBookingPool\modifyEvent().

+ Here is the caller graph for this function:

◆ setFullday()

ilCalendarEntry::setFullday (   $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.

@access public

Parameters
boolfullday

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

412 {
413 $this->fullday = (bool) $a_fullday;
414 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFurtherInformations()

ilCalendarEntry::setFurtherInformations (   $a_informations)

set further informations

@access public

Parameters
stringfurther informations

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

388 {
389 $this->further_informations = $a_informations;
390 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCalendarEntry::setLastUpdate (   $a_date)

set last update

@access public

Parameters

return

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

145 {
146 $this->last_update = $a_date;
147 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLocation()

ilCalendarEntry::setLocation (   $a_location)

set location

@access public

Parameters
stringlocation

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

366 {
367 $this->location = $a_location;
368 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMilestone()

ilCalendarEntry::setMilestone (   $a_status)

set milestone

@access public

Parameters

return

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

470 {
471 $this->is_milestone = $a_status;
472 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStart()

ilCalendarEntry::setStart (   $a_start)

@access public

Parameters

return

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

168 {
169 $this->start = $a_start;
170 }

Referenced by ilBookingProcessGUI\processBooking().

+ Here is the caller graph for this function:

◆ setSubtitle()

ilCalendarEntry::setSubtitle (   $a_subtitle)

set subtitle Used for automatic generated appointments.

Will be appended to the title.

@access public

Parameters
stringsubtitle
Returns

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

321 {
322 $this->subtitle = $a_subtitle;
323 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilCalendarEntry::setTitle (   $a_title)

set title

@access public

Parameters
stringtitle

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

200 {
201 $this->title = $a_title;
202 }

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

+ Here is the caller graph for this function:

◆ setTranslationType()

ilCalendarEntry::setTranslationType (   $a_type)

@access public

Parameters

return

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

525 {
526 $this->translation_type = $a_type;
527 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilCalendarEntry::update ( )

update

@access public

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

565 {
566 global $DIC;
567
568 $ilDB = $DIC['ilDB'];
569
570 $now = new ilDateTime(time(), IL_CAL_UNIX);
571 $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
572
573
574 $query = "UPDATE cal_entries " .
575 "SET title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
576 "last_update = " . $ilDB->quote($utc_timestamp, 'timestamp') . ", " .
577 "subtitle = " . $this->db->quote($this->getSubtitle(), 'text') . ", " .
578 "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
579 "location = " . $this->db->quote($this->getLocation(), 'text') . ", " .
580 "fullday = " . $ilDB->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
581 "starta = " . $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
582 "enda = " . $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
583 "informations = " . $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
584 "auto_generated = " . $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
585 "translation_type = " . $this->db->quote($this->getTranslationType(), 'integer') . ", " .
586 "context_id = " . $this->db->quote($this->getContextId(), 'integer') . ", " .
587 'context_info = ' . $this->db->quote($this->getContextInfo(), 'text') . ', ' .
588 "completion = " . $this->db->quote($this->getCompletion(), 'integer') . ", " .
589 "is_milestone = " . $this->db->quote($this->isMilestone() ? 1 : 0, 'integer') . ", " .
590 'notification = ' . $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
591 "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
592 $res = $ilDB->manipulate($query);
593
594 return true;
595 }

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

+ Here is the call graph for this function:

◆ validate()

ilCalendarEntry::validate ( )

validate

@access public

Returns

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

672 {
673 global $DIC;
674
675 $ilErr = $DIC['ilErr'];
676 $lng = $DIC['lng'];
677
678 $success = true;
679 $ilErr->setMessage('');
680 if (!strlen($this->getTitle())) {
681 $success = false;
682 $ilErr->appendMessage($lng->txt('err_missing_title'));
683 }
684 if (!$this->getStart() || !$this->getEnd()) {
685 $success = false;
686 } elseif (ilDateTime::_before($this->getEnd(), $this->getStart(), '')) {
687 $success = false;
688 $ilErr->appendMessage($lng->txt('err_end_before_start'));
689 }
690 return $success;
691 }
$success
Definition: Utf8Test.php:86
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
$ilErr
Definition: raiseError.php:18

References $DIC, $ilErr, $lng, $success, ilDateTime\_before(), getEnd(), getStart(), and getTitle().

+ Here is the call graph for this function:

◆ writeResponsibleUsers()

ilCalendarEntry::writeResponsibleUsers (   $a_users)

Write users responsible for a milestone.

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

764 {
765 global $DIC;
766
767 $ilDB = $DIC['ilDB'];
768
769 $ilDB->manipulateF(
770 "DELETE FROM cal_entry_responsible WHERE cal_id = %s",
771 array("integer"),
772 array($this->getEntryId())
773 );
774
775 if (is_array($a_users)) {
776 foreach ($a_users as $user_id) {
777 $ilDB->manipulateF(
778 "INSERT INTO cal_entry_responsible (cal_id, user_id) " .
779 " VALUES (%s,%s)",
780 array("integer", "integer"),
781 array($this->getEntryId(), $user_id)
782 );
783 }
784 }
785
786 $this->responsible_users = $a_users;
787 }

References $DIC, $ilDB, and getEntryId().

+ Here is the call graph for this function:

Field Documentation

◆ $completion

ilCalendarEntry::$completion = 0
protected

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

Referenced by getCompletion().

◆ $context_id

ilCalendarEntry::$context_id = 0
protected

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

Referenced by getContextId().

◆ $context_info

ilCalendarEntry::$context_info = ''
protected

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

Referenced by getContextInfo().

◆ $db

ilCalendarEntry::$db
protected

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

◆ $description

ilCalendarEntry::$description
protected

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

Referenced by getDescription().

◆ $end

ilCalendarEntry::$end = null
protected

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

Referenced by getEnd().

◆ $entry_id

ilCalendarEntry::$entry_id
protected

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

Referenced by getEntryId().

◆ $fullday

ilCalendarEntry::$fullday
protected

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

Referenced by isFullday().

◆ $further_informations

ilCalendarEntry::$further_informations
protected

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

Referenced by getFurtherInformations().

◆ $is_auto_generated

ilCalendarEntry::$is_auto_generated = false
protected

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

Referenced by isAutoGenerated().

◆ $is_milestone

ilCalendarEntry::$is_milestone = false
protected

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

Referenced by isMilestone().

◆ $last_update

ilCalendarEntry::$last_update
protected

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

◆ $location

ilCalendarEntry::$location
protected

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

Referenced by getLocation().

◆ $log

ilCalendarEntry::$log
protected

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

◆ $notification

ilCalendarEntry::$notification = false
protected

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

Referenced by isNotificationEnabled().

◆ $start

ilCalendarEntry::$start = null
protected

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

Referenced by getStart().

◆ $subtitle

ilCalendarEntry::$subtitle
protected

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

Referenced by getPresentationTitle(), and getSubtitle().

◆ $title

ilCalendarEntry::$title
protected

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

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

◆ $translation_type

ilCalendarEntry::$translation_type = IL_CAL_TRANSLATION_NONE
protected

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

Referenced by getTranslationType().


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