4include_once(
'Services/Calendar/classes/class.ilDate.php');
 
    5include_once(
'./Services/Calendar/interfaces/interface.ilDatePeriod.php');
 
    7define(
'IL_CAL_TRANSLATION_NONE', 0);
 
    8define(
'IL_CAL_TRANSLATION_SYSTEM', 1);
 
   57        $this->log = 
$DIC->logger()->cal();
 
   61        if ($this->entry_id = $a_id) {
 
   71        $this->entry_id = 
null;
 
   81    public static function _delete($a_entry_id)
 
   87        include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrence.php');
 
   90        $query = 
"DELETE FROM cal_entries " .
 
   91            "WHERE cal_id = " . 
$ilDB->quote($a_entry_id, 
'integer') . 
" ";
 
  103        $this->context_info = $a_info;
 
  146        $this->last_update = $a_date;
 
  169        $this->start = $a_start;
 
  201        $this->title = $a_title;
 
  232            if (preg_match(
"/#([a-z]+)#/", $this->
getSubtitle(), $matches)) {
 
  254        return $this->presentation_style;
 
  265            case "consultationhour":
 
  266                include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
  269                    if ($entry->isOwner()) {
 
  270                        $max = (int) $entry->getNumberOfBookings();
 
  271                        $current = (int) $entry->getCurrentNumberOfBookings($this->getEntryId());
 
  273                            $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
 
  275                        } elseif ($current >= $max) {
 
  276                            $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: red';
 
  279                            $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
 
  280                            $title = $current . 
'/' . $max;
 
  285                            $this->getContextId(),
 
  288                        $orig_event = $apps[0];
 
  289                        $max = $entry->getNumberOfBookings();
 
  290                        $current = $entry->getCurrentNumberOfBookings($this->
getEntryId());
 
  291                        if ($entry->hasBooked($orig_event)) {
 
  293                        } elseif ($current >= $max) {
 
  294                            $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: red';
 
  297                            $style = 
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
 
  306            $this->presentation_style = $style;
 
  322        $this->subtitle = $a_subtitle;
 
  345        $this->description = $a_description;
 
  367        $this->location = $a_location;
 
  389        $this->further_informations = $a_informations;
 
  413        $this->fullday = (bool) $a_fullday;
 
  447        $this->is_auto_generated = $a_status;
 
  471        $this->is_milestone = $a_status;
 
  481        $this->completion = $a_completion;
 
  503        $this->context_id = $a_context_id;
 
  526        $this->translation_type = $a_type;
 
  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') . 
", " .
 
  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') . 
", " .
 
  591            "WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
 
  609        $next_id = 
$ilDB->nextId(
'cal_entries');
 
  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) " .
 
  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') . 
", " .
 
  621            $this->db->quote($this->
getLocation(), 
'text') . 
", " .
 
  627            $this->db->quote($this->
getContextId(), 
'integer') . 
", " .
 
  631            $this->db->quote($this->
isMilestone() ? 1 : 0, 
'integer') . 
", " .
 
  636        $this->entry_id = $next_id;
 
  646    public function delete()
 
  652        include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrence.php');
 
  655        $query = 
"DELETE FROM cal_entries " .
 
  656            "WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
 
  659        include_once 
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
 
  682            $ilErr->appendMessage(
$lng->txt(
'err_missing_title'));
 
  688            $ilErr->appendMessage(
$lng->txt(
'err_end_before_start'));
 
  706        $query = 
"SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->
getEntryId(), 
'integer') . 
" ";
 
  741        $body = 
$lng->txt(
'cal_details');
 
  743        $body .= 
$lng->txt(
'title') . 
': ' . $this->
getTitle() . 
"\n";
 
  770            "DELETE FROM cal_entry_responsible WHERE cal_id = %s",
 
  775        if (is_array($a_users)) {
 
  776            foreach ($a_users as $user_id) {
 
  778                    "INSERT INTO cal_entry_responsible (cal_id, user_id) " .
 
  780                    array(
"integer", 
"integer"),
 
  786        $this->responsible_users = $a_users;
 
  798        $set = 
$ilDB->queryF(
 
  799            "SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
 
  805        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  807            $return[] = array_merge(
 
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_NONE
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
Model for a calendar entry.
setTranslationType($a_type)
@access public
enableNotification($a_status)
Enable course group notification.
setLastUpdate($a_date)
set last update
appointmentToMailString($lng)
writeResponsibleUsers($a_users)
Write users responsible for a milestone.
setAutoGenerated($a_status)
set auto generated
setFullday($a_fullday)
set fullday event Fullday events do not change their time in different timezones.
isMilestone()
is milestone
setLocation($a_location)
set location
static _delete($a_entry_id)
delete entry
setTitle($a_title)
set title
setCompletion($a_completion)
Set Completion.
setFurtherInformations($a_informations)
set further informations
getContextId()
get context id
setMilestone($a_status)
set milestone
readResponsibleUsers()
Read responsible users.
getEnd()
get end @access public
setStart($a_start)
@access public
__construct($a_id=0)
Constructor.
getTranslationType()
get translation type
getCompletion()
Get Completion.
setEnd($a_end)
set end @access public
parseDynamicTitle($a_type)
getPresentationTitle($a_shorten=true)
get title for presentation.
setContextId($a_context_id)
set context id
isAutoGenerated()
is auto generated
isNotificationEnabled()
Check if course group notification is enabled.
getSubtitle()
get subtitle
setContextInfo($a_info)
Set context info.
setSubtitle($a_subtitle)
set subtitle Used for automatic generated appointments.
getFurtherInformations()
get further informations
getLastUpdate()
get last update
getDescription()
get description
setDescription($a_description)
set description
getLocation()
get location
static _delete($a_cal_id)
delete
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.
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.
@classDescription Date and time handling
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.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
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.
foreach($_POST as $key=> $value) $res