3 declare(strict_types=1);
    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) {
    76     public static function _delete(
int $a_entry_id): void
    83         $query = 
"DELETE FROM cal_entries " .
    84             "WHERE cal_id = " . 
$ilDB->quote($a_entry_id, 
'integer') . 
" ";
    90         $this->context_info = $a_info;
   110         $this->last_update = $a_date;
   120         $this->start = $a_start;
   135         $this->title = $a_title;
   149             if (preg_match(
"/#([a-z]+)#/", $this->
getSubtitle(), $matches)) {
   156                     ? 
' (' . $subtitle . 
')'   170         $title = $style = 
"";
   172             case "consultationhour":
   175                     if ($entry->isOwner()) {
   176                         $max = $entry->getNumberOfBookings();
   177                         $current = $entry->getCurrentNumberOfBookings($this->
getEntryId());
   178                         $free = (($max - $current) >= 0 ? ($max - $current) : 0);
   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');
   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);
   196                             $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: red';
   197                             $title = $this->
lng->txt(
'cal_booked_out');
   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');
   208                                 $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
   209                                 $title = $this->
lng->txt(
'cal_book_free');
   216         if (strlen($style)) {
   217             $this->presentation_style = $style;
   235         $this->subtitle = $a_subtitle;
   245         $this->description = $a_description;
   255         $this->location = $a_location;
   265         $this->further_informations = $a_informations;
   280         $this->fullday = $a_fullday;
   295         $this->is_auto_generated = $a_status;
   300         $this->context_id = $a_context_id;
   310         $this->translation_type = $a_type;
   332         $query = 
"UPDATE cal_entries " .
   337             "SET title = " . $this->db->quote(mb_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') . 
", " .
   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') . 
', ' .
   351             "WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
   352         $res = $this->db->manipulate($query);
   357         $next_id = $this->db->nextId(
'cal_entries');
   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) " .
   364             $this->db->quote($next_id, 
'integer') . 
", " .
   369             $this->db->quote(mb_substr($this->
getTitle(), 0, 128), 
'text') . 
", " .
   370             $this->db->quote($utc_timestamp, 
'timestamp') . 
", " .
   371             $this->db->quote($this->
getSubtitle(), 
'text') . 
", " .
   373             $this->db->quote($this->
getLocation(), 
'text') . 
", " .
   374             $this->db->quote($this->
isFullday() ? 1 : 0, 
'integer') . 
", " .
   379             $this->db->quote($this->
getContextId(), 
'integer') . 
", " .
   384         $res = $this->db->manipulate($query);
   386         $this->entry_id = $next_id;
   389     public function delete(): 
void   393         $query = 
"DELETE FROM cal_entries " .
   394             "WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
   395         $res = $this->db->manipulate($query);
   403         $this->error->setMessage(
'');
   406             $this->error->appendMessage($this->
lng->txt(
'err_missing_title'));
   412             $this->error->appendMessage($this->
lng->txt(
'err_end_before_start'));
   417     protected function read(): void
   419         $query = 
"SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
   420         $res = $this->db->query($query);
   423             $this->
setTitle((
string) $row->title);
   447         $body = $lng->
txt(
'cal_details');
   449         $body .= $lng->
txt(
'title') . 
': ' . $this->
getTitle() . 
"\n";
   456             $body .= $lng->
txt(
'cal_where') . 
': ' . $this->
getLocation() . 
"\n";
 
static array static setUseRelativeDates(bool $a_status)
set use relative dates 
 
setTitle(string $a_title)
 
appointmentToMailString(ilLanguage $lng)
 
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...
 
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. 
 
setAutoGenerated(bool $a_status)
 
setContextId(int $a_context_id)
 
setStart(?ilDateTime $a_start)
 
setSubtitle(string $a_subtitle)
set subtitle Used for automatic generated appointments. 
 
getPresentationTitle(bool $a_shorten=true)
 
setLocation(string $a_location)
 
notification()
 description: > Example for rendring a notification glyph. 
 
static _delete(int $a_entry_id)
 
setFullday(bool $a_fullday)
set fullday event Fullday events do not change their time in different timezones. ...
 
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
 
getEnd()
Get end of period. 
 
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment. 
 
setFurtherInformations(string $a_informations)
 
isFullday()
is event a fullday period 
 
string $presentation_style
 
setTranslationType(int $a_type)
 
setContextInfo(string $a_info)
 
parseDynamicTitle(string $a_type)
 
setEnd(?ilDateTime $a_end)
 
getStart()
Get start of date period. 
 
enableNotification(bool $a_status)
 
setLastUpdate(ilDateTime $a_date)
 
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ilObjUser $user=null)
Format a period of two dates Shows: 14. 
 
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
 
setDescription(string $a_description)
 
static _delete(int $a_cal_id)
 
string $further_informations
 
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.