ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->read();
60  }
61  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilCalendarEntry::__clone ( )

clone instance

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

67  {
68  $this->entry_id = null;
69  }

◆ _delete()

static ilCalendarEntry::_delete (   $a_entry_id)
static

delete entry

public

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

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

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

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

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

693  {
694  $body = $lng->txt('cal_details');
695  $body .= "\n\n";
696  $body .= $lng->txt('title') . ': ' . $this->getTitle() . "\n";
697 
699  $body .= $lng->txt('date') . ': ' . ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd()) . "\n";
701 
702  if (strlen($this->getLocation())) {
703  $body .= $lng->txt('cal_where') . ': ' . $this->getLocation() . "\n";
704  }
705 
706  if (strlen($this->getDescription())) {
707  $body .= $lng->txt('description') . ': ' . $this->getDescription() . "\n";
708  }
709  return $body;
710  }
static setUseRelativeDates($a_status)
set use relative dates
getDescription()
get description
getEnd()
get end public
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
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 607 of file class.ilCalendarEntry.php.

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

608  {
609  global $ilDB;
610 
611  include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
613 
614  $query = "DELETE FROM cal_entries " .
615  "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
616  $res = $ilDB->manipulate($query);
617 
618  include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
620 
621  return true;
622  }
getEntryId()
get entry id
foreach($_POST as $key=> $value) $res
$query
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 511 of file class.ilCalendarEntry.php.

References notification().

Referenced by read().

512  {
513  $this->notification = $a_status;
514  }
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 456 of file class.ilCalendarEntry.php.

References $completion.

Referenced by save(), and update().

457  {
458  return $this->completion;
459  }
+ Here is the caller graph for this function:

◆ getContextId()

ilCalendarEntry::getContextId ( )

get context id

public

Returns

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

References $context_id.

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

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

◆ getDescription()

ilCalendarEntry::getDescription ( )

get description

public

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

References $description.

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

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

◆ getEnd()

ilCalendarEntry::getEnd ( )

get end public

Returns
ilDateTime end

Implements ilDatePeriod.

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

References $end.

Referenced by appointmentToMailString(), ilCalendarWeekGUI\getAppointmentTimeString(), ilCalendarScheduleFilterBookingPool\modifyEvent(), save(), update(), and validate().

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

◆ getEntryId()

◆ getFurtherInformations()

ilCalendarEntry::getFurtherInformations ( )

get further informations

public

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

References $further_informations.

Referenced by save(), and update().

365  {
367  }
+ Here is the caller graph for this function:

◆ getLastUpdate()

ilCalendarEntry::getLastUpdate ( )

get last update

public

Parameters

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

References IL_CAL_UNIX, and time.

111  {
112  return $this->last_update ? $this->last_update : new ilDateTime(time(), IL_CAL_UNIX);
113  }
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 342 of file class.ilCalendarEntry.php.

References $location.

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

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

◆ getPresentationStyle()

ilCalendarEntry::getPresentationStyle ( )

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

228  {
229  // see parseDynamicTitle()
230  return $this->presentation_style;
231  }

◆ getPresentationTitle()

ilCalendarEntry::getPresentationTitle (   $a_shorten = true)

get title for presentation.

Special handling for auto generated appointments

public

Returns

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

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

201  {
202  global $lng;
203 
205  $title = $this->getTitle();
206  } elseif (strlen($this->getSubtitle())) {
207  // parse dynamic title?
208  if (preg_match("/#([a-z]+)#/", $this->getSubtitle(), $matches)) {
209  $subtitle = $this->parseDynamicTitle($matches[1]);
210  } else {
211  $subtitle = $lng->txt($this->getSubtitle());
212  }
213  $title = $this->getTitle() .
214  (strlen($subtitle)
215  ? ' (' . $subtitle . ')'
216  : '');
217  } else {
218  $title = $lng->txt($this->getTitle());
219  }
220 
221  if ($a_shorten) {
222  return ilUtil::shortenText(ilUtil::shortenWords($title, 20), 40, true);
223  }
224  return $title;
225  }
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.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
const IL_CAL_TRANSLATION_NONE
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 134 of file class.ilCalendarEntry.php.

References $start.

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

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

◆ getSubtitle()

ilCalendarEntry::getSubtitle ( )

get subtitle

public

Returns

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

References $subtitle.

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

299  {
300  return $this->subtitle;
301  }
+ Here is the caller graph for this function:

◆ getTitle()

ilCalendarEntry::getTitle ( )

get title

public

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

References $title.

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

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

◆ getTranslationType()

ilCalendarEntry::getTranslationType ( )

get translation type

public

Returns
int translation type

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

References $translation_type.

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

503  {
505  }
+ Here is the caller graph for this function:

◆ isAutoGenerated()

ilCalendarEntry::isAutoGenerated ( )

is auto generated

public

Parameters

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

References $is_auto_generated.

Referenced by save(), and update().

401  {
402  return (bool) $this->is_auto_generated;
403  }
+ Here is the caller graph for this function:

◆ isFullday()

ilCalendarEntry::isFullday ( )

is fullday

public

Implements ilDatePeriod.

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

References $fullday.

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

389  {
390  return (bool) $this->fullday;
391  }
+ Here is the caller graph for this function:

◆ isMilestone()

ilCalendarEntry::isMilestone ( )

is milestone

public

Parameters

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

References $is_milestone.

Referenced by save(), and update().

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

◆ isNotificationEnabled()

ilCalendarEntry::isNotificationEnabled ( )

Check if course group notification is enabled.

Returns
bool

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

References $notification.

Referenced by save(), and update().

521  {
522  return (bool) $this->notification;
523  }
+ Here is the caller graph for this function:

◆ parseDynamicTitle()

ilCalendarEntry::parseDynamicTitle (   $a_type)
protected

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

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

Referenced by getPresentationTitle().

234  {
235  global $lng;
236 
237  $title = $style = "";
238  switch ($a_type) {
239  case "consultationhour":
240  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
241  $entry = new ilBookingEntry($this->getContextId());
242  if ($entry) {
243  if ($entry->isOwner()) {
244  $max = (int) $entry->getNumberOfBookings();
245  $current = (int) $entry->getCurrentNumberOfBookings($this->getEntryId());
246  if (!$current) {
247  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
248  $title = $lng->txt('cal_book_free');
249  } elseif ($current >= $max) {
250  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: red';
251  $title = $lng->txt('cal_booked_out');
252  } else {
253  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: yellow';
254  $title = $current . '/' . $max;
255  }
256  } else {
257  /*
258  * if($entry->hasBooked($this->getEntryId()))
259  */
260  include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
261  $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $this->getContextId(), $this->getStart());
262  $orig_event = $apps[0];
263  if ($entry->hasBooked($orig_event)) {
264  $style = ';border-left-width: 5px; border-left-style: solid; border-left-color: green';
265  $title = $lng->txt('cal_date_booked');
266  }
267  }
268  }
269  break;
270  }
271 
272  if ($style) {
273  $this->presentation_style = $style;
274  }
275  return $title;
276  }
$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:92
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 656 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().

657  {
658  global $ilDB;
659 
660  $query = "SELECT * FROM cal_entries WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
661  $res = $this->db->query($query);
662  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
663  $this->setLastUpdate(new ilDateTime($row->last_update, IL_CAL_DATETIME, 'UTC'));
664  $this->setTitle($row->title);
665  $this->setSubtitle($row->subtitle);
666  $this->setDescription($row->description);
667  $this->setLocation($row->location);
668  $this->setFurtherInformations($row->informations);
669  $this->setFullday((bool) $row->fullday);
670  $this->setAutoGenerated($row->auto_generated);
671  $this->setContextId($row->context_id);
672  $this->setTranslationType($row->translation_type);
673  $this->setCompletion($row->completion);
674  $this->setMilestone($row->is_milestone);
675  $this->enableNotification((bool) $row->notification);
676 
677  if ($this->isFullday()) {
678  $this->start = new ilDate($row->starta, IL_CAL_DATETIME);
679  $this->end = new ilDate($row->enda, IL_CAL_DATETIME);
680  } else {
681  $this->start = new ilDateTime($row->starta, IL_CAL_DATETIME, 'UTC');
682  $this->end = new ilDateTime($row->enda, IL_CAL_DATETIME, 'UTC');
683  }
684  }
685  }
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.
foreach($_POST as $key=> $value) $res
Date and time handling
$query
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 743 of file class.ilCalendarEntry.php.

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

744  {
745  global $ilDB;
746 
747  $set = $ilDB->queryF(
748  "SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
749  array("integer"),
750  array($this->getEntryId())
751  );
752 
753  $return = array();
754  while ($rec = $ilDB->fetchAssoc($set)) {
755  $n = ilObjUser::_lookupName($rec["user_id"]);
756  $return[] = array_merge(
757  $n,
758  array("login" => ilObjUser::_lookupLogin($rec["user_id"]))
759  );
760  }
761 
762  return $return;
763  }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
getEntryId()
get entry id
$n
Definition: RandomTest.php:85
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 567 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.

568  {
569  global $ilDB;
570 
571  $next_id = $ilDB->nextId('cal_entries');
572  $now = new ilDateTime(time(), IL_CAL_UNIX);
573  $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
574 
575  $query = "INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, " .
576  "informations,auto_generated,context_id,translation_type, completion, is_milestone, notification) " .
577  "VALUES( " .
578  $ilDB->quote($next_id, 'integer') . ", " .
579  $this->db->quote($this->getTitle(), 'text') . ", " .
580  $ilDB->quote($utc_timestamp, 'timestamp') . ", " .
581  $this->db->quote($this->getSubtitle(), 'text') . ", " .
582  $this->db->quote($this->getDescription(), 'text') . ", " .
583  $this->db->quote($this->getLocation(), 'text') . ", " .
584  $ilDB->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
585  $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
586  $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
587  $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
588  $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
589  $this->db->quote($this->getContextId(), 'integer') . ", " .
590  $this->db->quote($this->getTranslationType(), 'integer') . ", " .
591  $this->db->quote($this->getCompletion(), 'integer') . ", " .
592  $this->db->quote($this->isMilestone() ? 1 : 0, 'integer') . ", " .
593  $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
594  ")";
595  $res = $ilDB->manipulate($query);
596 
597  $this->entry_id = $next_id;
598  return true;
599  }
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.
foreach($_POST as $key=> $value) $res
isAutoGenerated()
is auto generated
Date and time handling
$query
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 412 of file class.ilCalendarEntry.php.

Referenced by read().

413  {
414  $this->is_auto_generated = $a_status;
415  }
+ Here is the caller graph for this function:

◆ setCompletion()

ilCalendarEntry::setCompletion (   $a_completion)

Set Completion.

Parameters
int$a_completionCompletion

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

Referenced by read().

447  {
448  $this->completion = $a_completion;
449  }
+ 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 468 of file class.ilCalendarEntry.php.

References $a_context_id.

Referenced by read().

469  {
470  $this->context_id = $a_context_id;
471  }
$a_context_id
Definition: workflow.php:97
+ Here is the caller graph for this function:

◆ setDescription()

ilCalendarEntry::setDescription (   $a_description)

set description

public

Parameters
stringdescription

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

Referenced by read().

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

◆ setEnd()

ilCalendarEntry::setEnd (   $a_end)

set end public

Parameters

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

Referenced by ilCalendarScheduleFilterBookingPool\modifyEvent().

166  {
167  $this->end = $a_end;
168  }
+ Here is the caller graph for this function:

◆ 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 378 of file class.ilCalendarEntry.php.

Referenced by read().

379  {
380  $this->fullday = (bool) $a_fullday;
381  }
+ Here is the caller graph for this function:

◆ setFurtherInformations()

ilCalendarEntry::setFurtherInformations (   $a_informations)

set further informations

public

Parameters
stringfurther informations

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

Referenced by read().

355  {
356  $this->further_informations = $a_informations;
357  }
+ Here is the caller graph for this function:

◆ setLastUpdate()

ilCalendarEntry::setLastUpdate (   $a_date)

set last update

public

Parameters

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

Referenced by read().

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

◆ setLocation()

ilCalendarEntry::setLocation (   $a_location)

set location

public

Parameters
stringlocation

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

Referenced by read().

333  {
334  $this->location = $a_location;
335  }
+ Here is the caller graph for this function:

◆ setMilestone()

ilCalendarEntry::setMilestone (   $a_status)

set milestone

public

Parameters

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

Referenced by read().

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

◆ setStart()

ilCalendarEntry::setStart (   $a_start)

public

Parameters

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

Referenced by ilObjBookingPoolGUI\processBooking().

146  {
147  $this->start = $a_start;
148  }
+ 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 287 of file class.ilCalendarEntry.php.

Referenced by read().

288  {
289  $this->subtitle = $a_subtitle;
290  }
+ Here is the caller graph for this function:

◆ setTitle()

ilCalendarEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

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

◆ setTranslationType()

ilCalendarEntry::setTranslationType (   $a_type)

public

Parameters

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

References $a_type.

Referenced by read().

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

◆ update()

ilCalendarEntry::update ( )

update

public

Definition at line 531 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.

532  {
533  global $ilDB;
534 
535  $now = new ilDateTime(time(), IL_CAL_UNIX);
536  $utc_timestamp = $now->get(IL_CAL_DATETIME, '', ilTimeZone::UTC);
537 
538 
539  $query = "UPDATE cal_entries " .
540  "SET title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
541  "last_update = " . $ilDB->quote($utc_timestamp, 'timestamp') . ", " .
542  "subtitle = " . $this->db->quote($this->getSubtitle(), 'text') . ", " .
543  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
544  "location = " . $this->db->quote($this->getLocation(), 'text') . ", " .
545  "fullday = " . $ilDB->quote($this->isFullday() ? 1 : 0, 'integer') . ", " .
546  "starta = " . $this->db->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
547  "enda = " . $this->db->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
548  "informations = " . $this->db->quote($this->getFurtherInformations(), 'text') . ", " .
549  "auto_generated = " . $this->db->quote($this->isAutoGenerated(), 'integer') . ", " .
550  "translation_type = " . $this->db->quote($this->getTranslationType(), 'integer') . ", " .
551  "context_id = " . $this->db->quote($this->getContextId(), 'integer') . ", " .
552  "completion = " . $this->db->quote($this->getCompletion(), 'integer') . ", " .
553  "is_milestone = " . $this->db->quote($this->isMilestone() ? 1 : 0, 'integer') . ", " .
554  'notification = ' . $this->db->quote($this->isNotificationEnabled() ? 1 : 0, 'integer') . ' ' .
555  "WHERE cal_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
556  $res = $ilDB->manipulate($query);
557 
558  return true;
559  }
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.
foreach($_POST as $key=> $value) $res
isAutoGenerated()
is auto generated
Date and time handling
$query
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 630 of file class.ilCalendarEntry.php.

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

631  {
632  global $ilErr,$lng;
633 
634  $success = true;
635  $ilErr->setMessage('');
636  if (!strlen($this->getTitle())) {
637  $success = false;
638  $ilErr->appendMessage($lng->txt('err_missing_title'));
639  }
640  if (!$this->getStart() || !$this->getEnd()) {
641  $success = false;
642  } elseif (ilDateTime::_before($this->getEnd(), $this->getStart(), '')) {
643  $success = false;
644  $ilErr->appendMessage($lng->txt('err_end_before_start'));
645  }
646  return $success;
647  }
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 716 of file class.ilCalendarEntry.php.

References $ilDB, array, and getEntryId().

717  {
718  global $ilDB;
719 
720  $ilDB->manipulateF(
721  "DELETE FROM cal_entry_responsible WHERE cal_id = %s",
722  array("integer"),
723  array($this->getEntryId())
724  );
725 
726  if (is_array($a_users)) {
727  foreach ($a_users as $user_id) {
728  $ilDB->manipulateF(
729  "INSERT INTO cal_entry_responsible (cal_id, user_id) " .
730  " VALUES (%s,%s)",
731  array("integer", "integer"),
732  array($this->getEntryId(), $user_id)
733  );
734  }
735  }
736 
737  $this->responsible_users = $a_users;
738  }
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: