ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 getEntryId ()
 get entry id
 getLastUpdate ()
 get last update
 setLastUpdate ($a_date)
 set last update
 getStart ()
 get start
 setStart (ilDateTime $a_start)
 public
 getEnd ()
 get end public
 setEnd ($a_end)
 set end public
 setTitle ($a_title)
 set title
 getTitle ()
 get title
 getPresentationTitle ()
 get title for presentation.
 setSubtitle ($a_subtitle)
 set subtitle Used for automatic generated appointments.
 getSubtitle ()
 get subtitle
 setDescription ($a_description)
 set description
 getDescription ()
 get description
 setLocation ($a_location)
 set location
 getLocation ()
 get location
 setFurtherInformations ($a_informations)
 set further informations
 getFurtherInformations ()
 get further informations
 setFullday ($a_fullday)
 set fullday event Fullday events do not change their time in different timezones.
 isFullday ()
 is fullday
 isAutoGenerated ()
 is auto generated
 setAutoGenerated ($a_status)
 set auto generated
 setContextId ($a_context_id)
 set context id
 getContextId ()
 get context id
 setTranslationType ($a_type)
 public
 getTranslationType ()
 get translation type
 update ()
 update
 save ()
 save one entry
 delete ()
 delete
 validate ()
 validate

Static Public Member Functions

static _delete ($a_entry_id)
 delete entry

Protected Member Functions

 read ()
 protected

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

Detailed Description

Model for a calendar entry.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

ilCalendarEntry::__construct (   $a_id = 0)

Constructor.

public

Parameters
intcal_entry id

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

References $ilLog, and read().

{
global $ilDB,$ilLog;
$this->log = $ilLog;
$this->db = $ilDB;
if($this->entry_id = $a_id)
{
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarEntry::_delete (   $a_entry_id)
static

delete entry

public

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

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

{
global $ilDB;
include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
$query = "DELETE FROM cal_entries ".
"WHERE cal_id = ".$ilDB->quote($a_entry_id)." ";
$ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

ilCalendarEntry::delete ( )

delete

public

Returns

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

References _delete(), and getEntryId().

{
include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
$query = "DELETE FROM cal_entries ".
"WHERE cal_id = ".$this->db->quote($this->getEntryId())." ";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilCalendarEntry::getContextId ( )

get context id

public

Returns

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

References $context_id.

{
}
ilCalendarEntry::getDescription ( )

get description

public

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

References $description.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getEnd ( )

get end public

Returns
ilDateTime end

Implements ilDatePeriod.

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

Referenced by validate().

{
return $this->end ? $this->end : $this->end = new ilDateTime();
}

+ Here is the caller graph for this function:

ilCalendarEntry::getEntryId ( )

get entry id

public

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

References $entry_id.

Referenced by delete(), and read().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getFurtherInformations ( )

get further informations

public

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

References $further_informations.

ilCalendarEntry::getLastUpdate ( )

get last update

public

Parameters
@return

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

References IL_CAL_UNIX.

{
return $this->last_update ? $this->last_update : new ilDateTime(time(),IL_CAL_UNIX);
}
ilCalendarEntry::getLocation ( )

get location

public

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

References $location.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getPresentationTitle ( )

get title for presentation.

Special handling for auto generated appointments

public

Returns

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

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

{
global $ilUser,$lng;
{
$title = $this->getTitle();
}
else
{
$title = $this->getTitle().' ('.$lng->txt($this->getSubtitle()).')';
}
}

+ Here is the call graph for this function:

ilCalendarEntry::getStart ( )

get start

public

Returns

Implements ilDatePeriod.

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

Referenced by validate().

{
return $this->start ? $this->start : $this->start = new ilDateTime();
}

+ Here is the caller graph for this function:

ilCalendarEntry::getSubtitle ( )

get subtitle

public

Returns

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

References $subtitle.

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

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getTitle ( )

get title

public

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

References $title.

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

{
return $this->title;
}

+ Here is the caller graph for this function:

ilCalendarEntry::getTranslationType ( )

get translation type

public

Returns
int translation type

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

References $translation_type.

Referenced by getPresentationTitle().

+ Here is the caller graph for this function:

ilCalendarEntry::isAutoGenerated ( )

is auto generated

public

Parameters
@return

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

References $is_auto_generated.

{
return (bool) $this->is_auto_generated;
}
ilCalendarEntry::isFullday ( )

is fullday

public

Implements ilDatePeriod.

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

References $fullday.

Referenced by read().

{
return (bool) $this->fullday;
}

+ Here is the caller graph for this function:

ilCalendarEntry::read ( )
protected

protected

Parameters

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

References $res, DB_FETCHMODE_OBJECT, getEntryId(), IL_CAL_DATETIME, isFullday(), setAutoGenerated(), setContextId(), setDescription(), setFullday(), setFurtherInformations(), setLastUpdate(), setLocation(), setSubtitle(), setTitle(), and setTranslationType().

Referenced by __construct().

{
$query = "SELECT * FROM cal_entries WHERE cal_id = ".$this->db->quote($this->getEntryId())." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setLastUpdate(new ilDateTime($row->last_update,IL_CAL_DATETIME,'UTC'));
$this->setTitle($row->title);
$this->setSubtitle($row->subtitle);
$this->setDescription($row->description);
$this->setLocation($row->location);
$this->setFurtherInformations($row->informations);
$this->setFullday((bool) $row->fullday);
$this->setAutoGenerated($row->auto_generated);
$this->setContextId($row->context_id);
$this->setTranslationType($row->translation_type);
if($this->isFullday())
{
$this->start = new ilDate($row->start,IL_CAL_DATETIME);
$this->end = new ilDate($row->end,IL_CAL_DATETIME);
}
else
{
$this->start = new ilDateTime($row->start,IL_CAL_DATETIME,'UTC');
$this->end = new ilDateTime($row->end,IL_CAL_DATETIME,'UTC');
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarEntry::save ( )

save one entry

public

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

References $res, getDescription(), getLocation(), getSubtitle(), getTitle(), and IL_CAL_DATETIME.

{
$query = "INSERT INTO cal_entries ".
"SET title = ".$this->db->quote($this->getTitle()).", ".
"last_update = UTC_TIMESTAMP(), ".
"subtitle = ".$this->db->quote($this->getSubtitle()).", ".
"description = ".$this->db->quote($this->getDescription()).", ".
"location = ".$this->db->quote($this->getLocation()).", ".
"fullday = ".($this->isFullday() ? 1 : 0).", ".
"start = ".$this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC')).", ".
"end = ".$this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC')).", ".
"informations = ".$this->db->quote($this->getFurtherInformations()).", ".
"auto_generated = ".$this->db->quote($this->isAutoGenerated()).", ".
"context_id = ".$this->db->quote($this->getContextId()).", ".
"translation_type = ".$this->db->quote($this->getTranslationType())." ";
$res = $this->db->query($query);
$this->entry_id = $this->db->getLastInsertId();
return true;
}

+ Here is the call graph for this function:

ilCalendarEntry::setAutoGenerated (   $a_status)

set auto generated

public

Parameters
@return

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

Referenced by read().

{
$this->is_auto_generated = $a_status;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setContextId (   $a_context_id)

set context id

public

Parameters
intcontext id
Returns

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

Referenced by read().

{
$this->context_id = $a_context_id;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setDescription (   $a_description)

set description

public

Parameters
stringdescription

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

Referenced by read().

{
$this->description = $a_description;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setEnd (   $a_end)

set end public

Parameters

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

{
$this->end = $a_end;
}
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 326 of file class.ilCalendarEntry.php.

Referenced by read().

{
$this->fullday = (bool) $a_fullday;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setFurtherInformations (   $a_informations)

set further informations

public

Parameters
stringfurther informations

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

Referenced by read().

{
$this->further_informations = $a_informations;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setLastUpdate (   $a_date)

set last update

public

Parameters
@return

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

Referenced by read().

{
$this->last_update = $a_date;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setLocation (   $a_location)

set location

public

Parameters
stringlocation

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

Referenced by read().

{
$this->location = $a_location;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setStart ( ilDateTime  $a_start)

public

Parameters
@return

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

{
$this->start = $a_start;
}
ilCalendarEntry::setSubtitle (   $a_subtitle)

set subtitle Used for automatic generated appointments.

Will be appended to the title.

public

Parameters
stringsubtitle
Returns

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

Referenced by read().

{
$this->subtitle = $a_subtitle;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setTranslationType (   $a_type)

public

Parameters
@return

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

Referenced by read().

{
$this->translation_type = $a_type;
}

+ Here is the caller graph for this function:

ilCalendarEntry::update ( )

update

public

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

References $res, getDescription(), getLocation(), getSubtitle(), getTitle(), and IL_CAL_DATETIME.

{
$query = "UPDATE cal_entries ".
"SET title = ".$this->db->quote($this->getTitle()).", ".
"last_update = UTC_TIMESTAMP(), ".
"subtitle = ".$this->db->quote($this->getSubtitle()).", ".
"description = ".$this->db->quote($this->getDescription()).", ".
"location = ".$this->db->quote($this->getLocation()).", ".
"fullday = ".($this->isFullday() ? 1 : 0).", ".
"start = ".$this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC')).", ".
"end = ".$this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC')).", ".
"informations = ".$this->db->quote($this->getFurtherInformations()).", ".
"auto_generated = ".$this->db->quote($this->isAutoGenerated()).", ".
"translation_type = ".$this->db->quote($this->getTranslationType()).", ".
"context_id = ".$this->db->quote($this->getContextId())." ".
"WHERE cal_id = ".$this->db->quote($this->getEntryId())." ";
$res = $this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilCalendarEntry::validate ( )

validate

public

Returns

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

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

{
global $ilErr,$lng;
$success = true;
$ilErr->setMessage('');
if(!strlen($this->getTitle()))
{
$success = false;
$ilErr->appendMessage($lng->txt('err_missing_title'));
}
if(ilDateTime::_before($this->getEnd(),$this->getStart(),''))
{
$success = false;
$ilErr->appendMessage($lng->txt('err_end_before_start'));
}
return $success;
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarEntry::$context_id = 0
protected

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

Referenced by getContextId().

ilCalendarEntry::$db
protected

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

ilCalendarEntry::$description
protected

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

Referenced by getDescription().

ilCalendarEntry::$end = null
protected

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

ilCalendarEntry::$entry_id
protected

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

Referenced by getEntryId().

ilCalendarEntry::$fullday
protected

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

Referenced by isFullday().

ilCalendarEntry::$further_informations
protected

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

Referenced by getFurtherInformations().

ilCalendarEntry::$is_auto_generated = false
protected

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

Referenced by isAutoGenerated().

ilCalendarEntry::$last_update
protected

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

ilCalendarEntry::$location
protected

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

Referenced by getLocation().

ilCalendarEntry::$log
protected

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

ilCalendarEntry::$start = null
protected

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

ilCalendarEntry::$subtitle
protected

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

Referenced by getSubtitle().

ilCalendarEntry::$title
protected

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

Referenced by getPresentationTitle(), and getTitle().

ilCalendarEntry::$translation_type = IL_CAL_TRANSLATION_NONE
protected

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

Referenced by getTranslationType().


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