4 include_once(
'Services/Calendar/classes/class.ilDate.php');
5 include_once(
'./Services/Calendar/interfaces/interface.ilDatePeriod.php');
7 define(
'IL_CAL_TRANSLATION_NONE', 0);
8 define(
'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';
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';
286 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
288 $orig_event = $apps[0];
289 if ($entry->hasBooked($orig_event)) {
290 $style =
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
299 $this->presentation_style =
$style;
315 $this->subtitle = $a_subtitle;
338 $this->description = $a_description;
360 $this->location = $a_location;
382 $this->further_informations = $a_informations;
406 $this->fullday = (bool) $a_fullday;
440 $this->is_auto_generated = $a_status;
464 $this->is_milestone = $a_status;
474 $this->completion = $a_completion;
519 $this->translation_type =
$a_type;
561 $ilDB = $DIC[
'ilDB'];
567 $query =
"UPDATE cal_entries " .
568 "SET title = " . $this->db->quote($this->
getTitle(),
'text') .
", " .
569 "last_update = " .
$ilDB->quote($utc_timestamp,
'timestamp') .
", " .
570 "subtitle = " . $this->db->quote($this->
getSubtitle(),
'text') .
", " .
571 "description = " . $this->db->quote($this->
getDescription(),
'text') .
", " .
572 "location = " . $this->db->quote($this->
getLocation(),
'text') .
", " .
573 "fullday = " .
$ilDB->quote($this->
isFullday() ? 1 : 0,
'integer') .
", " .
577 "auto_generated = " . $this->db->quote($this->
isAutoGenerated(),
'integer') .
", " .
578 "translation_type = " . $this->db->quote($this->
getTranslationType(),
'integer') .
", " .
579 "context_id = " . $this->db->quote($this->
getContextId(),
'integer') .
", " .
580 'context_info = ' . $this->db->quote($this->
getContextInfo(),
'text') .
', ' .
581 "completion = " . $this->db->quote($this->
getCompletion(),
'integer') .
", " .
582 "is_milestone = " . $this->db->quote($this->
isMilestone() ? 1 : 0,
'integer') .
", " .
584 "WHERE cal_id = " . $this->db->quote($this->
getEntryId(),
'integer') .
" ";
600 $ilDB = $DIC[
'ilDB'];
602 $next_id =
$ilDB->nextId(
'cal_entries');
606 $query =
"INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, " .
607 "informations,auto_generated,context_id,context_info,translation_type, completion, is_milestone, notification) " .
609 $ilDB->quote($next_id,
'integer') .
", " .
610 $this->db->quote($this->
getTitle(),
'text') .
", " .
611 $ilDB->quote($utc_timestamp,
'timestamp') .
", " .
612 $this->db->quote($this->
getSubtitle(),
'text') .
", " .
614 $this->db->quote($this->
getLocation(),
'text') .
", " .
620 $this->db->quote($this->
getContextId(),
'integer') .
", " .
624 $this->db->quote($this->
isMilestone() ? 1 : 0,
'integer') .
", " .
629 $this->entry_id = $next_id;
639 public function delete()
643 $ilDB = $DIC[
'ilDB'];
645 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrence.php');
648 $query =
"DELETE FROM cal_entries " .
649 "WHERE cal_id = " . $this->db->quote($this->
getEntryId(),
'integer') .
" ";
652 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
675 $ilErr->appendMessage(
$lng->txt(
'err_missing_title'));
681 $ilErr->appendMessage(
$lng->txt(
'err_end_before_start'));
697 $ilDB = $DIC[
'ilDB'];
699 $query =
"SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->
getEntryId(),
'integer') .
" ";
734 $body =
$lng->txt(
'cal_details');
736 $body .=
$lng->txt(
'title') .
': ' . $this->
getTitle() .
"\n";
760 $ilDB = $DIC[
'ilDB'];
763 "DELETE FROM cal_entry_responsible WHERE cal_id = %s",
768 if (is_array($a_users)) {
769 foreach ($a_users as $user_id) {
771 "INSERT INTO cal_entry_responsible (cal_id, user_id) " .
773 array(
"integer",
"integer"),
779 $this->responsible_users = $a_users;
789 $ilDB = $DIC[
'ilDB'];
791 $set =
$ilDB->queryF(
792 "SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
798 while ($rec =
$ilDB->fetchAssoc($set)) {
800 $return[] = array_merge(
getTranslationType()
get translation type
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
setContextId($a_context_id)
set context id
Model for a calendar entry.
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.
getPresentationTitle($a_shorten=true)
get title for presentation.
setTitle($a_title)
set title
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
setLastUpdate($a_date)
set last update
enableNotification($a_status)
Enable course group notification.
const IL_CAL_TRANSLATION_NONE
parseDynamicTitle($a_type)
setFurtherInformations($a_informations)
set further informations
setDescription($a_description)
set description
readResponsibleUsers()
Read responsible users.
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.
getFurtherInformations()
get further informations
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
setSubtitle($a_subtitle)
set subtitle Used for automatic generated appointments.
getSubtitle()
get subtitle
isMilestone()
is milestone
static _delete($a_entry_id)
delete entry
setFullday($a_fullday)
set fullday event Fullday events do not change their time in different timezones. ...
getDescription()
get description
getCompletion()
Get Completion.
foreach($_POST as $key=> $value) $res
writeResponsibleUsers($a_users)
Write users responsible for a milestone.
isAutoGenerated()
is auto generated
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
getContextId()
get context id
setCompletion($a_completion)
Set Completion.
appointmentToMailString($lng)
static _delete($a_cal_id)
delete
setTranslationType($a_type)
public
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
setLocation($a_location)
set location
getLocation()
get location
setMilestone($a_status)
set milestone
setContextInfo($a_info)
Set context info.
__construct($a_id=0)
Constructor.
isNotificationEnabled()
Check if course group notification is enabled.
setEnd($a_end)
set end public
getLastUpdate()
get last update
setAutoGenerated($a_status)
set auto generated