ILIAS  Release_4_0_x_branch Revision 61816
 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
 isMilestone ()
 is milestone
 setMilestone ($a_status)
 set milestone
 setCompletion ($a_completion)
 Set Completion.
 getCompletion ()
 Get Completion.
 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
 writeResponsibleUsers ($a_users)
 Write users responsible for a milestone.
 readResponsibleUsers ()
 Read responsible users.

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
 $is_milestone = false
 $completion = 0

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

Constructor & Destructor Documentation

ilCalendarEntry::__construct (   $a_id = 0)

Constructor.

public

Parameters
intcal_entry id

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

References $ilDB, $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 70 of file class.ilCalendarEntry.php.

References $ilDB, $query, and $res.

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 ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilCalendarEntry::delete ( )

delete

public

Returns

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

References $ilDB, $query, $res, _delete(), and getEntryId().

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

+ Here is the call graph for this function:

ilCalendarEntry::getCompletion ( )

Get Completion.

Returns
int Completion

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

References $completion.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getContextId ( )

get context id

public

Returns

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

References $context_id.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getDescription ( )

get description

public

Definition at line 251 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 148 of file class.ilCalendarEntry.php.

Referenced by save(), update(), and 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 90 of file class.ilCalendarEntry.php.

References $entry_id.

Referenced by delete(), read(), readResponsibleUsers(), update(), and writeResponsibleUsers().

{
}

+ Here is the caller graph for this function:

ilCalendarEntry::getFurtherInformations ( )

get further informations

public

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

References $further_informations.

Referenced by save(), and update().

+ Here is the caller graph for this function:

ilCalendarEntry::getLastUpdate ( )

get last update

public

Parameters
@return

Definition at line 102 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 273 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 193 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 126 of file class.ilCalendarEntry.php.

Referenced by save(), update(), and 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 229 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 181 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 433 of file class.ilCalendarEntry.php.

References $translation_type.

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

+ Here is the caller graph for this function:

ilCalendarEntry::isAutoGenerated ( )

is auto generated

public

Parameters
@return

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

References $is_auto_generated.

Referenced by save(), and update().

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

+ Here is the caller graph for this function:

ilCalendarEntry::isFullday ( )

is fullday

public

Implements ilDatePeriod.

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

References $fullday.

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

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

+ Here is the caller graph for this function:

ilCalendarEntry::isMilestone ( )

is milestone

public

Parameters
@return

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

References $is_milestone.

Referenced by save(), and update().

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

+ Here is the caller graph for this function:

ilCalendarEntry::read ( )
protected

protected

Parameters

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

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

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM cal_entries WHERE cal_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
$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);
$this->setCompletion($row->completion);
$this->setMilestone($row->is_milestone);
if($this->isFullday())
{
$this->start = new ilDate($row->starta,IL_CAL_DATETIME);
$this->end = new ilDate($row->enda,IL_CAL_DATETIME);
}
else
{
$this->start = new ilDateTime($row->starta,IL_CAL_DATETIME,'UTC');
$this->end = new ilDateTime($row->enda,IL_CAL_DATETIME,'UTC');
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarEntry::readResponsibleUsers ( )

Read responsible users.

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

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

{
global $ilDB;
$set = $ilDB->queryF("SELECT * FROM cal_entry_responsible WHERE cal_id = %s",
array("integer"), array($this->getEntryId()));
$return = array();
while($rec = $ilDB->fetchAssoc($set))
{
$n = ilObjUser::_lookupName($rec["user_id"]);
$return[] = array_merge($n,
array("login" => ilObjUser::_lookupLogin($rec["user_id"])));
}
return $return;
}

+ Here is the call graph for this function:

ilCalendarEntry::save ( )

save one entry

public

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

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

{
global $ilDB;
$next_id = $ilDB->nextId('cal_entries');
$now = new ilDateTime(time(),IL_CAL_UNIX);
$utc_timestamp = $now->get(IL_CAL_TIMESTAMP,'',ilTimeZone::UTC);
$query = "INSERT INTO cal_entries (cal_id,title,last_update,subtitle,description,location,fullday,starta,enda, ".
"informations,auto_generated,context_id,translation_type, completion, is_milestone) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').", ".
$this->db->quote($this->getTitle(),'text').", ".
$ilDB->quote($utc_timestamp,'timestamp').", ".
$this->db->quote($this->getSubtitle(),'text').", ".
$this->db->quote($this->getDescription() ,'text').", ".
$this->db->quote($this->getLocation() ,'text').", ".
$ilDB->quote($this->isFullday() ? 1 : 0,'integer').", ".
$this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
$this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
$this->db->quote($this->getFurtherInformations() ,'text').", ".
$this->db->quote($this->isAutoGenerated() ,'integer').", ".
$this->db->quote($this->getContextId() ,'integer').", ".
$this->db->quote($this->getTranslationType() ,'integer').", ".
$this->db->quote($this->getCompletion(), 'integer').", ".
$this->db->quote($this->isMilestone() ? 1 : 0, 'integer')." ".
")";
$res = $ilDB->manipulate($query);
$this->entry_id = $next_id;
return true;
}

+ Here is the call graph for this function:

ilCalendarEntry::setAutoGenerated (   $a_status)

set auto generated

public

Parameters
@return

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

Referenced by read().

{
$this->is_auto_generated = $a_status;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setCompletion (   $a_completion)

Set Completion.

Parameters
int$a_completionCompletion

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

Referenced by read().

{
$this->completion = $a_completion;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setContextId (   $a_context_id)

set context id

public

Parameters
intcontext id
Returns

Definition at line 399 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 241 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 158 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 309 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 285 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 114 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 263 of file class.ilCalendarEntry.php.

Referenced by read().

{
$this->location = $a_location;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setMilestone (   $a_status)

set milestone

public

Parameters
@return

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

Referenced by read().

{
$this->is_milestone = $a_status;
}

+ Here is the caller graph for this function:

ilCalendarEntry::setStart ( ilDateTime  $a_start)

public

Parameters
@return

Definition at line 138 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 218 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 170 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 422 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 444 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_TIMESTAMP, IL_CAL_UNIX, isAutoGenerated(), isFullday(), isMilestone(), and ilTimeZone\UTC.

{
global $ilDB;
$now = new ilDateTime(time(),IL_CAL_UNIX);
$utc_timestamp = $now->get(IL_CAL_TIMESTAMP,'',ilTimeZone::UTC);
$query = "UPDATE cal_entries ".
"SET title = ".$this->db->quote($this->getTitle() ,'text').", ".
"last_update = ".$ilDB->quote($utc_timestamp,'timestamp').", ".
"subtitle = ".$this->db->quote($this->getSubtitle() ,'text').", ".
"description = ".$this->db->quote($this->getDescription(),'text').", ".
"location = ".$this->db->quote($this->getLocation() ,'text').", ".
"fullday = ".$ilDB->quote($this->isFullday() ? 1 : 0,'integer').", ".
"starta = ".$this->db->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
"enda = ".$this->db->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC'),'timestamp').", ".
"informations = ".$this->db->quote($this->getFurtherInformations() ,'text').", ".
"auto_generated = ".$this->db->quote($this->isAutoGenerated() ,'integer').", ".
"translation_type = ".$this->db->quote($this->getTranslationType() ,'integer').", ".
"context_id = ".$this->db->quote($this->getContextId() ,'integer').", ".
"completion = ".$this->db->quote($this->getCompletion(), 'integer').", ".
"is_milestone = ".$this->db->quote($this->isMilestone() ? 1 : 0, 'integer')." ".
"WHERE cal_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilCalendarEntry::validate ( )

validate

public

Returns

Definition at line 538 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:

ilCalendarEntry::writeResponsibleUsers (   $a_users)

Write users responsible for a milestone.

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

References $ilDB, and getEntryId().

{
global $ilDB;
$ilDB->manipulateF("DELETE FROM cal_entry_responsible WHERE cal_id = %s",
array("integer"), array($this->getEntryId()));
if (is_array($a_users))
{
foreach ($a_users as $user_id)
{
$ilDB->manipulateF("INSERT INTO cal_entry_responsible (cal_id, user_id) ".
" VALUES (%s,%s)", array("integer", "integer"),
array($this->getEntryId(), $user_id));
}
}
$this->responsible_users = $a_users;
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarEntry::$completion = 0
protected

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

Referenced by getCompletion().

ilCalendarEntry::$context_id = 0
protected

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

Referenced by getContextId().

ilCalendarEntry::$db
protected

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

ilCalendarEntry::$description
protected

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

Referenced by getDescription().

ilCalendarEntry::$end = null
protected

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

ilCalendarEntry::$entry_id
protected

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

Referenced by getEntryId().

ilCalendarEntry::$fullday
protected

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

Referenced by isFullday().

ilCalendarEntry::$further_informations
protected

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

Referenced by getFurtherInformations().

ilCalendarEntry::$is_auto_generated = false
protected

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

Referenced by isAutoGenerated().

ilCalendarEntry::$is_milestone = false
protected

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

Referenced by isMilestone().

ilCalendarEntry::$last_update
protected

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

ilCalendarEntry::$location
protected

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

Referenced by getLocation().

ilCalendarEntry::$log
protected

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

ilCalendarEntry::$start = null
protected

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

ilCalendarEntry::$subtitle
protected

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

Referenced by getSubtitle().

ilCalendarEntry::$title
protected

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

Referenced by getPresentationTitle(), and getTitle().

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: