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);
58 if($this->entry_id = $a_id)
69 $this->entry_id = NULL;
79 public static function _delete($a_entry_id)
83 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrence.php');
86 $query =
"DELETE FROM cal_entries ".
87 "WHERE cal_id = ".$ilDB->quote($a_entry_id ,
'integer').
" ";
125 $this->last_update = $a_date;
137 return $this->start ? $this->start : $this->start =
new ilDateTime();
149 $this->start = $a_start;
159 return $this->end ? $this->end : $this->end =
new ilDateTime();
181 $this->title = $a_title;
213 if(preg_match(
"/#([a-z]+)#/", $this->
getSubtitle(), $matches))
241 return $this->presentation_style;
251 case "consultationhour":
252 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
256 if($entry->isOwner())
258 $max = (int)$entry->getNumberOfBookings();
259 $current = (int)$entry->getCurrentNumberOfBookings($this->getEntryId());
262 $style =
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
263 $title = $lng->txt(
'cal_book_free');
265 elseif($current >= $max)
267 $style =
';border-left-width: 5px; border-left-style: solid; border-left-color: red';
268 $title = $lng->txt(
'cal_booked_out');
272 $style =
';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
273 $title = $current.
'/'.$max;
281 include_once
'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
283 $orig_event = $apps[0];
284 if($entry->hasBooked($orig_event))
286 $style =
';border-left-width: 5px; border-left-style: solid; border-left-color: green';
287 $title = $lng->txt(
'cal_date_booked');
296 $this->presentation_style = $style;
312 $this->subtitle = $a_subtitle;
335 $this->description = $a_description;
357 $this->location = $a_location;
379 $this->further_informations = $a_informations;
403 $this->fullday = (bool) $a_fullday;
437 $this->is_auto_generated = $a_status;
461 $this->is_milestone = $a_status;
471 $this->completion = $a_completion;
493 $this->context_id = $a_context_id;
516 $this->translation_type = $a_type;
536 $this->notification = $a_status;
562 $query =
"UPDATE cal_entries ".
563 "SET title = ".$this->db->quote($this->
getTitle() ,
'text').
", ".
564 "last_update = ".$ilDB->quote($utc_timestamp,
'timestamp').
", ".
565 "subtitle = ".$this->db->quote($this->
getSubtitle() ,
'text').
", ".
566 "description = ".$this->db->quote($this->
getDescription(),
'text').
", ".
567 "location = ".$this->db->quote($this->
getLocation() ,
'text').
", ".
568 "fullday = ".$ilDB->quote($this->
isFullday() ? 1 : 0,
'integer').
", ".
572 "auto_generated = ".$this->db->quote($this->
isAutoGenerated() ,
'integer').
", ".
574 "context_id = ".$this->db->quote($this->
getContextId() ,
'integer').
", ".
575 "completion = ".$this->db->quote($this->
getCompletion(),
'integer').
", ".
576 "is_milestone = ".$this->db->quote($this->
isMilestone() ? 1 : 0,
'integer').
", ".
578 "WHERE cal_id = ".$this->db->quote($this->
getEntryId() ,
'integer').
" ";
594 $next_id = $ilDB->nextId(
'cal_entries');
598 $query =
"INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, ".
599 "informations,auto_generated,context_id,translation_type, completion, is_milestone, notification) ".
601 $ilDB->quote($next_id,
'integer').
", ".
602 $this->db->quote($this->
getTitle(),
'text').
", ".
603 $ilDB->quote($utc_timestamp,
'timestamp').
", ".
604 $this->db->quote($this->
getSubtitle(),
'text').
", ".
606 $this->db->quote($this->
getLocation() ,
'text').
", ".
607 $ilDB->quote($this->
isFullday() ? 1 : 0,
'integer').
", ".
612 $this->db->quote($this->
getContextId() ,
'integer').
", ".
615 $this->db->quote($this->
isMilestone() ? 1 : 0,
'integer').
", ".
620 $this->entry_id = $next_id;
630 public function delete()
634 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrence.php');
637 $query =
"DELETE FROM cal_entries ".
638 "WHERE cal_id = ".$this->db->quote($this->
getEntryId() ,
'integer').
" ";
641 include_once
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
658 $ilErr->setMessage(
'');
662 $ilErr->appendMessage($lng->txt(
'err_missing_title'));
667 $ilErr->appendMessage($lng->txt(
'err_end_before_start'));
683 $query =
"SELECT * FROM cal_entries WHERE cal_id = ".$this->db->quote($this->
getEntryId() ,
'integer').
" ";
722 $body =
$lng->txt(
'cal_details');
724 $body .=
$lng->txt(
'title').
': '.$this->
getTitle().
"\n";
750 $ilDB->manipulateF(
"DELETE FROM cal_entry_responsible WHERE cal_id = %s",
751 array(
"integer"), array($this->
getEntryId()));
753 if (is_array($a_users))
755 foreach ($a_users as $user_id)
757 $ilDB->manipulateF(
"INSERT INTO cal_entry_responsible (cal_id, user_id) ".
758 " VALUES (%s,%s)", array(
"integer",
"integer"),
763 $this->responsible_users = $a_users;
773 $set = $ilDB->queryF(
"SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
774 array(
"integer"), array($this->
getEntryId()));
777 while($rec = $ilDB->fetchAssoc($set))
780 $return[] = array_merge(
$n,