ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 getEntryId ()
 get entry id More...
 
 getLastUpdate ()
 get last update More...
 
 setLastUpdate ($a_date)
 set last update More...
 
 getStart ()
 get start More...
 
 setStart ($a_start)
 public More...
 
 getEnd ()
 get end public More...
 
 setEnd ($a_end)
 set end 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)
 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...
 

Static Public Member Functions

static _delete ($a_entry_id)
 delete entry More...
 

Protected Member Functions

 parseDynamicTitle ($a_type)
 
 read ()
 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
 
 $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.

public

Parameters
intcal_entry id

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

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

52  {
53  global $ilDB,$ilLog;
54 
55  $this->log = $ilLog;
56  $this->db = $ilDB;
57 
58  if($this->entry_id = $a_id)
59  {
60  $this->read();
61  }
62  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilCalendarEntry::__clone ( )

clone instance

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

68  {
69  $this->entry_id = NULL;
70  }

◆ _delete()

static ilCalendarEntry::_delete (   $a_entry_id)
static

delete entry

public

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

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

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

80  {
81  global $ilDB;
82 
83  include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
84  ilCalendarRecurrence::_delete($a_entry_id);
85 
86  $query = "DELETE FROM cal_entries ".
87  "WHERE cal_id = ".$ilDB->quote($a_entry_id ,'integer')." ";
88  $res = $ilDB->manipulate($query);
89 
90  return true;
91  }
static _delete($a_cal_id)
delete
global $ilDB
+ 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 724 of file class.ilCalendarEntry.php.

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

725  {
726  $body = $lng->txt('cal_details');
727  $body .= "\n\n";
728  $body .= $lng->txt('title').': '.$this->getTitle()."\n";
729 
731  $body .= $lng->txt('date').': '.ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd())."\n";
733 
734  if(strlen($this->getLocation()))
735  {
736  $body .= $lng->txt('cal_where').': '.$this->getLocation()."\n";
737  }
738 
739  if(strlen($this->getDescription()))
740  {
741  $body .= $lng->txt('description').': '.$this->getDescription()."\n";
742  }
743  return $body;
744  }
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
getDescription()
get description
getEnd()
get end public
getLocation()
get location
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ delete()

ilCalendarEntry::delete ( )

delete

public

Returns

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

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

631  {
632  global $ilDB;
633 
634  include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
636 
637  $query = "DELETE FROM cal_entries ".
638  "WHERE cal_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
639  $res = $ilDB->manipulate($query);
640 
641  include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
643 
644  return true;
645  }
getEntryId()
get entry id
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static _delete($a_cal_id)
delete
global $ilDB
+ Here is the call graph for this function:

◆ enableNotification()

ilCalendarEntry::enableNotification (   $a_status)

Enable course group notification.

Parameters
bool$a_status

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

References notification().

Referenced by read().

535  {
536  $this->notification = $a_status;
537  }
notification()
Definition: notification.php:2
+ 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 479 of file class.ilCalendarEntry.php.

References $completion.

Referenced by save(), and update().

480  {
481  return $this->completion;
482  }
+ Here is the caller graph for this function:

◆ getContextId()

ilCalendarEntry::getContextId ( )

get context id

public

Returns

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

References $context_id.

Referenced by ilCalendarScheduleFilterBookings\modifyEvent(), ilCalendarScheduleFilterExercise\modifyEvent(), parseDynamicTitle(), save(), and update().

503  {
504  return $this->context_id;
505  }
+ Here is the caller graph for this function:

◆ getDescription()

ilCalendarEntry::getDescription ( )

get description

public

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

References $description.

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

344  {
345  return $this->description;
346  }
+ Here is the caller graph for this function:

◆ getEnd()

ilCalendarEntry::getEnd ( )

get end public

Returns
ilDateTime end

Implements ilDatePeriod.

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

References $end.

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

158  {
159  return $this->end;
160  }
+ Here is the caller graph for this function:

◆ getEntryId()

◆ getFurtherInformations()

ilCalendarEntry::getFurtherInformations ( )

get further informations

public

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

References $further_informations.

Referenced by save(), and update().

388  {
390  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCalendarEntry::getLastUpdate ( )

get last update

public

Parameters

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

References IL_CAL_UNIX, and time.

112  {
113  return $this->last_update ? $this->last_update : new ilDateTime(time(),IL_CAL_UNIX);
114  }
const IL_CAL_UNIX
Date and time handling
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ getLocation()

ilCalendarEntry::getLocation ( )

get location

public

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

References $location.

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

366  {
367  return $this->location;
368  }
+ Here is the caller graph for this function:

◆ getPresentationStyle()

ilCalendarEntry::getPresentationStyle ( )

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

239  {
240  // see parseDynamicTitle()
241  return $this->presentation_style;
242  }

◆ getPresentationTitle()

ilCalendarEntry::getPresentationTitle (   $a_shorten = true)

get title for presentation.

Special handling for auto generated appointments

public

Returns

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

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

203  {
204  global $lng;
205 
207  {
208  $title = $this->getTitle();
209  }
210  elseif(strlen($this->getSubtitle()))
211  {
212  // parse dynamic title?
213  if(preg_match("/#([a-z]+)#/", $this->getSubtitle(), $matches))
214  {
215  $subtitle = $this->parseDynamicTitle($matches[1]);
216  }
217  else
218  {
219  $subtitle = $lng->txt($this->getSubtitle());
220  }
221  $title = $this->getTitle().
222  (strlen($subtitle)
223  ? ' ('.$subtitle.')'
224  : '');
225  }
226  else
227  {
228  $title = $lng->txt($this->getTitle());
229  }
230 
231  if($a_shorten)
232  {
233  return ilUtil::shortenText(ilUtil::shortenWords($title,20),40,true);
234  }
235  return $title;
236  }
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.
const IL_CAL_TRANSLATION_NONE
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
getSubtitle()
get subtitle
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ getStart()

ilCalendarEntry::getStart ( )

get start

public

Returns

Implements ilDatePeriod.

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

References $start.

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

136  {
137  return $this->start;
138 
139  }
+ Here is the caller graph for this function:

◆ getSubtitle()

ilCalendarEntry::getSubtitle ( )

get subtitle

public

Returns

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

References $subtitle.

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

322  {
323  return $this->subtitle;
324  }
+ Here is the caller graph for this function:

◆ getTitle()

ilCalendarEntry::getTitle ( )

get title

public

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

References $title.

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

191  {
192  return $this->title;
193  }
+ Here is the caller graph for this function:

◆ getTranslationType()

ilCalendarEntry::getTranslationType ( )

get translation type

public

Returns
int translation type

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

References $translation_type.

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

526  {
528  }
+ Here is the caller graph for this function:

◆ isAutoGenerated()

ilCalendarEntry::isAutoGenerated ( )

is auto generated

public

Parameters

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

References $is_auto_generated.

Referenced by save(), and update().

424  {
425  return (bool) $this->is_auto_generated;
426  }
+ Here is the caller graph for this function:

◆ isFullday()

ilCalendarEntry::isFullday ( )

is fullday

public

Implements ilDatePeriod.

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

References $fullday.

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

412  {
413  return (bool) $this->fullday;
414  }
+ Here is the caller graph for this function:

◆ isMilestone()

ilCalendarEntry::isMilestone ( )

is milestone

public

Parameters

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

References $is_milestone.

Referenced by save(), and update().

448  {
449  return (bool) $this->is_milestone;
450  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilCalendarEntry::isNotificationEnabled ( )

Check if course group notification is enabled.

Returns
bool

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

References $notification.

Referenced by save(), and update().

544  {
545  return (bool) $this->notification;
546  }
+ Here is the caller graph for this function:

◆ parseDynamicTitle()

ilCalendarEntry::parseDynamicTitle (   $a_type)
protected

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

References $a_type, $lng, $style, $title, ilConsultationHourAppointments\getAppointmentIds(), getContextId(), and getStart().

Referenced by getPresentationTitle().

245  {
246  global $lng;
247 
248  $title = $style = "";
249  switch($a_type)
250  {
251  case "consultationhour":
252  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
253  $entry = new ilBookingEntry($this->getContextId());
254  if($entry)
255  {
256  if($entry->isOwner())
257  {
258  $max = (int)$entry->getNumberOfBookings();
259  $current = (int)$entry->getCurrentNumberOfBookings($this->getEntryId());
260  if(!$current)
261  {
262  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
263  $title = $lng->txt('cal_book_free');
264  }
265  elseif($current >= $max)
266  {
267  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
268  $title = $lng->txt('cal_booked_out');
269  }
270  else
271  {
272  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
273  $title = $current.'/'.$max;
274  }
275  }
276  else
277  {
278  /*
279  * if($entry->hasBooked($this->getEntryId()))
280  */
281  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
282  $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $this->getContextId(), $this->getStart());
283  $orig_event = $apps[0];
284  if($entry->hasBooked($orig_event))
285  {
286  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
287  $title = $lng->txt('cal_date_booked');
288  }
289  }
290  }
291  break;
292  }
293 
294  if($style)
295  {
296  $this->presentation_style = $style;
297  }
298  return $title;
299  }
$style
Definition: example_012.php:70
static getAppointmentIds($a_user_id, $a_context_id=NULL, $a_start=NULL, $a_type=NULL, $a_check_owner=true)
Get all appointment ids.
Booking definition.
$a_type
Definition: workflow.php:93
getContextId()
get context id
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilCalendarEntry::read ( )
protected

protected

Parameters

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

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

Referenced by __construct().

684  {
685  global $ilDB;
686 
687  $query = "SELECT * FROM cal_entries WHERE cal_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
688  $res = $this->db->query($query);
689  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
690  {
691  $this->setLastUpdate(new ilDateTime($row->last_update,IL_CAL_DATETIME,'UTC'));
692  $this->setTitle($row->title);
693  $this->setSubtitle($row->subtitle);
694  $this->setDescription($row->description);
695  $this->setLocation($row->location);
696  $this->setFurtherInformations($row->informations);
697  $this->setFullday((bool) $row->fullday);
698  $this->setAutoGenerated($row->auto_generated);
699  $this->setContextId($row->context_id);
700  $this->setTranslationType($row->translation_type);
701  $this->setCompletion($row->completion);
702  $this->setMilestone($row->is_milestone);
703  $this->enableNotification((bool) $row->notification);
704 
705  if($this->isFullday())
706  {
707  $this->start = new ilDate($row->starta,IL_CAL_DATETIME);
708  $this->end = new ilDate($row->enda,IL_CAL_DATETIME);
709  }
710  else
711  {
712  $this->start = new ilDateTime($row->starta,IL_CAL_DATETIME,'UTC');
713  $this->end = new ilDateTime($row->enda,IL_CAL_DATETIME,'UTC');
714  }
715  }
716 
717  }
setContextId($a_context_id)
set context id
setTitle($a_title)
set title
const IL_CAL_DATETIME
setLastUpdate($a_date)
set last update
enableNotification($a_status)
Enable course group notification.
setFurtherInformations($a_informations)
set further informations
setDescription($a_description)
set description
getEntryId()
get entry id
setSubtitle($a_subtitle)
set subtitle Used for automatic generated appointments.
setFullday($a_fullday)
set fullday event Fullday events do not change their time in different timezones. ...
Class for single dates.
Date and time handling
setCompletion($a_completion)
Set Completion.
setTranslationType($a_type)
public
setLocation($a_location)
set location
setMilestone($a_status)
set milestone
global $ilDB
setAutoGenerated($a_status)
set auto generated
+ 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 773 of file class.ilCalendarEntry.php.

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

774  {
775  global $ilDB;
776 
777  $set = $ilDB->queryF("SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
778  array("integer"), array($this->getEntryId()));
779 
780  $return = array();
781  while($rec = $ilDB->fetchAssoc($set))
782  {
783  $n = ilObjUser::_lookupName($rec["user_id"]);
784  $return[] = array_merge($n,
785  array("login" => ilObjUser::_lookupLogin($rec["user_id"])));
786  }
787 
788  return $return;
789  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
getEntryId()
get entry id
$n
Definition: RandomTest.php:80
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ save()

ilCalendarEntry::save ( )

save one entry

public

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

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

591  {
592  global $ilDB;
593 
594  $next_id = $ilDB->nextId('cal_entries');
595  $now = new ilDateTime(time(),IL_CAL_UNIX);
596  $utc_timestamp = $now->get(IL_CAL_DATETIME,'',ilTimeZone::UTC);
597 
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) ".
600  "VALUES( ".
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').", ".
605  $this->db->quote($this->getDescription() ,'text').", ".
606  $this->db->quote($this->getLocation() ,'text').", ".
607  $ilDB->quote($this->isFullday() ? 1 : 0,'integer').", ".
608  $this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
609  $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
610  $this->db->quote($this->getFurtherInformations() ,'text').", ".
611  $this->db->quote($this->isAutoGenerated() ,'integer').", ".
612  $this->db->quote($this->getContextId() ,'integer').", ".
613  $this->db->quote($this->getTranslationType() ,'integer').", ".
614  $this->db->quote($this->getCompletion(), 'integer').", ".
615  $this->db->quote($this->isMilestone() ? 1 : 0, 'integer').", ".
616  $this->db->quote($this->isNotificationEnabled() ? 1 : 0,'integer').' '.
617  ")";
618  $res = $ilDB->manipulate($query);
619 
620  $this->entry_id = $next_id;
621  return true;
622  }
getTranslationType()
get translation type
const IL_CAL_DATETIME
getFurtherInformations()
get further informations
const IL_CAL_UNIX
getSubtitle()
get subtitle
isMilestone()
is milestone
getDescription()
get description
getEnd()
get end public
getCompletion()
Get Completion.
isAutoGenerated()
is auto generated
Date and time handling
getContextId()
get context id
getLocation()
get location
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
isNotificationEnabled()
Check if course group notification is enabled.
+ Here is the call graph for this function:

◆ setAutoGenerated()

ilCalendarEntry::setAutoGenerated (   $a_status)

set auto generated

public

Parameters

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

Referenced by read().

436  {
437  $this->is_auto_generated = $a_status;
438  }
+ Here is the caller graph for this function:

◆ setCompletion()

ilCalendarEntry::setCompletion (   $a_completion)

Set Completion.

Parameters
int$a_completionCompletion

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

Referenced by read().

470  {
471  $this->completion = $a_completion;
472  }
+ Here is the caller graph for this function:

◆ setContextId()

ilCalendarEntry::setContextId (   $a_context_id)

set context id

public

Parameters
intcontext id
Returns

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

References $a_context_id.

Referenced by read().

492  {
493  $this->context_id = $a_context_id;
494  }
$a_context_id
Definition: workflow.php:98
+ Here is the caller graph for this function:

◆ setDescription()

ilCalendarEntry::setDescription (   $a_description)

set description

public

Parameters
stringdescription

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

Referenced by read().

334  {
335  $this->description = $a_description;
336  }
+ Here is the caller graph for this function:

◆ setEnd()

ilCalendarEntry::setEnd (   $a_end)

set end public

Parameters

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

168  {
169  $this->end = $a_end;
170  }

◆ 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.

public

Parameters
boolfullday

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

Referenced by read().

402  {
403  $this->fullday = (bool) $a_fullday;
404  }
+ Here is the caller graph for this function:

◆ setFurtherInformations()

ilCalendarEntry::setFurtherInformations (   $a_informations)

set further informations

public

Parameters
stringfurther informations

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

Referenced by read().

378  {
379  $this->further_informations = $a_informations;
380  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCalendarEntry::setLastUpdate (   $a_date)

set last update

public

Parameters

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

Referenced by read().

124  {
125  $this->last_update = $a_date;
126  }
+ Here is the caller graph for this function:

◆ setLocation()

ilCalendarEntry::setLocation (   $a_location)

set location

public

Parameters
stringlocation

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

Referenced by read().

356  {
357  $this->location = $a_location;
358  }
+ Here is the caller graph for this function:

◆ setMilestone()

ilCalendarEntry::setMilestone (   $a_status)

set milestone

public

Parameters

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

Referenced by read().

460  {
461  $this->is_milestone = $a_status;
462  }
+ Here is the caller graph for this function:

◆ setStart()

ilCalendarEntry::setStart (   $a_start)

public

Parameters

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

Referenced by ilObjBookingPoolGUI\processBooking().

148  {
149  $this->start = $a_start;
150  }
+ 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.

public

Parameters
stringsubtitle
Returns

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

Referenced by read().

311  {
312  $this->subtitle = $a_subtitle;
313  }
+ Here is the caller graph for this function:

◆ setTitle()

ilCalendarEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

180  {
181  $this->title = $a_title;
182  }
+ Here is the caller graph for this function:

◆ setTranslationType()

ilCalendarEntry::setTranslationType (   $a_type)

public

Parameters

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

References $a_type.

Referenced by read().

515  {
516  $this->translation_type = $a_type;
517  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ update()

ilCalendarEntry::update ( )

update

public

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

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

555  {
556  global $ilDB;
557 
558  $now = new ilDateTime(time(),IL_CAL_UNIX);
559  $utc_timestamp = $now->get(IL_CAL_DATETIME,'',ilTimeZone::UTC);
560 
561 
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').", ".
569  "starta = ".$this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
570  "enda = ".$this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
571  "informations = ".$this->db->quote($this->getFurtherInformations() ,'text').", ".
572  "auto_generated = ".$this->db->quote($this->isAutoGenerated() ,'integer').", ".
573  "translation_type = ".$this->db->quote($this->getTranslationType() ,'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').", ".
577  'notification = '.$this->db->quote($this->isNotificationEnabled() ? 1 : 0,'integer').' '.
578  "WHERE cal_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
579  $res = $ilDB->manipulate($query);
580 
581  return true;
582  }
getTranslationType()
get translation type
const IL_CAL_DATETIME
getFurtherInformations()
get further informations
getEntryId()
get entry id
const IL_CAL_UNIX
getSubtitle()
get subtitle
isMilestone()
is milestone
getDescription()
get description
getEnd()
get end public
getCompletion()
Get Completion.
isAutoGenerated()
is auto generated
Date and time handling
getContextId()
get context id
getLocation()
get location
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
isNotificationEnabled()
Check if course group notification is enabled.
+ Here is the call graph for this function:

◆ validate()

ilCalendarEntry::validate ( )

validate

public

Returns

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

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

654  {
655  global $ilErr,$lng;
656 
657  $success = true;
658  $ilErr->setMessage('');
659  if(!strlen($this->getTitle()))
660  {
661  $success = false;
662  $ilErr->appendMessage($lng->txt('err_missing_title'));
663  }
664  if(!$this->getStart() || !$this->getEnd())
665  {
666  $success = false;
667  }
668  else if(ilDateTime::_before($this->getEnd(),$this->getStart(),''))
669  {
670  $success = false;
671  $ilErr->appendMessage($lng->txt('err_end_before_start'));
672  }
673  return $success;
674  }
global $ilErr
Definition: raiseError.php:16
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.
getEnd()
get end public
$success
Definition: Utf8Test.php:86
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ writeResponsibleUsers()

ilCalendarEntry::writeResponsibleUsers (   $a_users)

Write users responsible for a milestone.

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

References $ilDB, array, and getEntryId().

751  {
752  global $ilDB;
753 
754  $ilDB->manipulateF("DELETE FROM cal_entry_responsible WHERE cal_id = %s",
755  array("integer"), array($this->getEntryId()));
756 
757  if (is_array($a_users))
758  {
759  foreach ($a_users as $user_id)
760  {
761  $ilDB->manipulateF("INSERT INTO cal_entry_responsible (cal_id, user_id) ".
762  " VALUES (%s,%s)", array("integer", "integer"),
763  array($this->getEntryId(), $user_id));
764  }
765  }
766 
767  $this->responsible_users = $a_users;
768  }
getEntryId()
get entry id
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $completion

ilCalendarEntry::$completion = 0
protected

Definition at line 40 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().

◆ $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 39 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 42 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 38 of file class.ilCalendarEntry.php.

Referenced by getTranslationType().


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