ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarDataSet Class Reference

Calendar data set class. More...

+ Inheritance diagram for ilCalendarDataSet:
+ Collaboration diagram for ilCalendarDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions.
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace.
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data.
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record.
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor.
 init ($a_entity, $a_schema_version)
 Init.
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB.
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories.
 setImportDirectory ($a_val)
 Set import directory.
 getImportDirectory ()
 Get import directory.
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix.
 getDSPrefix ()
 Get XML dataset namespace prefix.
 getDSPrefixString ()
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields.
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string.
 getJsonRepresentation ()
 Get json representation.
 getXmlRepresentation ($a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ...
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml.
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record.
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces.
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version.
 getJsonRecord ($a_set)
 Get json record for version.
 getXmlTypes ($a_entity, $a_version)
 Get xml types.
 getJsonTypes ($a_entity, $a_version)
 Get json types.
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten)
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag.
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten)
 setImport ($a_val)
 Set import object.
 getImport ()
 Get import object.

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity.
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data.
- Protected Member Functions inherited from ilDataSet
 createObjectExportId ($a_type, $a_id)
 Build ilias export id.
 parseObjectExportId ($a_id, $a_fallback_id=NULL)
 Parse export id.

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
const EXPORT_NO_INST_ID = 1
const EXPORT_ID_ILIAS_LOCAL = 2
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
const EXPORT_ID_ILIAS_REMOTE = 4
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
const EXPORT_ID = 6
const EXPORT_ID_INVALID = 7

Detailed Description

Calendar data set class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilCalendarDataSet.php.

Member Function Documentation

ilCalendarDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 204 of file class.ilCalendarDataSet.php.

References ilCalendarCategoryAssignments\_getAssignedAppointments().

{
switch ($a_entity)
{
case "calendar":
include_once("./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php");
$assignmnts = ilCalendarCategoryAssignments::_getAssignedAppointments(array($a_rec["CatId"]));
$entries = array();
foreach ($assignmnts as $cal_id)
{
$entries[$cal_id] = $cal_id;
}
return array (
"cal_entry" => array("ids" => $entries),
"cal_assignment" => array("ids" => $a_rec["CatId"])
);
case "cal_entry":
return array (
"recurrence_rule" => array("ids" => $a_rec["Id"])
);
}
return false;
}

+ Here is the call graph for this function:

ilCalendarDataSet::getSupportedVersions ( )

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 21 of file class.ilCalendarDataSet.php.

{
return array("4.3.0");
}
ilCalendarDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

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

{
// calendar
if ($a_entity == "calendar")
{
switch ($a_version)
{
case "4.3.0":
return array (
"CatId" => "integer",
"ObjId" => "text",
"Title" => "text",
"Color" => "text",
"Type" => "integer"
);
}
}
// calendar entry
if ($a_entity == "cal_entry")
{
switch ($a_version)
{
case "4.3.0":
return array (
"Id" => "integer",
"Title" => "text",
"Subtitle" => "text",
"Description" => "text",
"Location" => "text",
"Fullday" => "integer",
"Starta" => "text",
"Enda" => "text",
"Informations" => "text",
"AutoGenerated" => "integer",
"ContextId" => "integer",
"TranslationType" => "integer",
"IsMilestone" => "integer",
"Completion" => "integer",
"Notification" => "integer"
);
}
}
// calendar/entry assignment
if ($a_entity == "cal_assignment")
{
switch ($a_version)
{
case "4.3.0":
return array (
"CatId" => "integer",
"EntryId" => "integer"
);
}
}
// recurrence rule
if ($a_entity == "recurrence_rule")
{
switch ($a_version)
{
case "4.3.0":
return array (
"RuleId" => "integer",
"EntryId" => "integer",
"CalRecurrence" => "integer",
"FreqType" => "text",
"FreqUntilDate" => "text",
"FreqUntilCount" => "integer",
"Intervall" => "integer",
"Byday" => "text",
"Byweekno" => "text",
"Bymonth" => "text",
"Bymonthday" => "text",
"Byyearday" => "text",
"Bysetpos" => "text",
"Weekstart" => "text"
);
}
}
}
ilCalendarDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

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

{
return "http://www.ilias.de/xml/Services/Calendar/".$a_entity;
}
ilCalendarDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

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

References $usr_id, ilObject\_lookupType(), IL_CAL_DATETIME, and ilCalendarCategory\TYPE_USR.

{
switch ($a_entity)
{
case "calendar":
// please note: we currently only support private user calendars to
// be imported
if ($a_rec["Type"] == 1)
{
$usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["ObjId"]);
if ($usr_id > 0 && ilObject::_lookupType($usr_id) == "usr")
{
include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
$category = new ilCalendarCategory(0);
$category->setTitle($a_rec["Title"]);
$category->setColor($a_rec["Color"]);
$category->setType(ilCalendarCategory::TYPE_USR);
$category->setObjId($usr_id);
$category->add();
$a_mapping->addMapping("Services/Calendar", "calendar", $a_rec["CatId"],
$category->getCategoryID());
}
}
break;
case "cal_entry":
// please note: we currently only support private user calendars to
// be imported
if ((int) $a_rec["ContextId"] == 0)
{
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
$entry = new ilCalendarEntry(0);
$entry->setTitle($a_rec["Title"]);
$entry->setSubtitle($a_rec["Subtitle"]);
$entry->setDescription($a_rec["Description"]);
$entry->setLocation($a_rec["Location"]);
$entry->setFullday($a_rec["Fullday"]);
if ($a_rec["Starta"] != "")
{
$entry->setStart(new ilDateTime($a_rec["Starta"], IL_CAL_DATETIME, 'UTC'));
}
if ($a_rec["Enda"] != "")
{
$entry->setEnd(new ilDateTime($a_rec["Enda"], IL_CAL_DATETIME, 'UTC'));
}
$entry->setFurtherInformations($a_rec["Informations"]);
$entry->setAutoGenerated($a_rec["AutoGenerated"]);
$entry->setContextId($a_rec["ContextId"]);
$entry->setMilestone($a_rec["Milestone"]);
$entry->setCompletion($a_rec["Completion"]);
$entry->setTranslationType($a_rec["TranslationType"]);
$entry->enableNotification($a_rec["Notification"]);
$entry->save();
$a_mapping->addMapping("Services/Calendar", "cal_entry", $a_rec["Id"],
$entry->getEntryId());
}
break;
case "cal_assignment":
$cat_id = $a_mapping->getMapping("Services/Calendar", "calendar", $a_rec["CatId"]);
$entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
if ($cat_id > 0 && $entry_id > 0)
{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
$ass = new ilCalendarCategoryAssignments($entry_id);
$ass->addAssignment($cat_id);
}
break;
case "recurrence_rule":
$entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
if ($entry_id > 0)
{
include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
$rec = new ilCalendarRecurrence();
$rec->setEntryId($entry_id);
$rec->setRecurrence($a_rec["CalRecurrence"]);
$rec->setFrequenceType($a_rec["FreqType"]);
if ($a_rec["FreqUntilDate"] != "")
{
$rec->setFrequenceUntilDate(new ilDateTime($a_rec["FreqUntilDate"], IL_CAL_DATETIME));
}
$rec->setFrequenceUntilCount($a_rec["FreqUntilCount"]);
$rec->setInterval($a_rec["Interval"]);
$rec->setBYDAY($a_rec["Byday"]);
$rec->setBYWEEKNO($a_rec["Byweekno"]);
$rec->setBYMONTH($a_rec["Bymonth"]);
$rec->setBYMONTHDAY($a_rec["Bymonthday"]);
$rec->setBYYEARDAY($a_rec["Byyearday"]);
$rec->setBYSETPOS($a_rec["Bysetpos"]);
$rec->setWeekstart($a_rec["Weekstart"]);
$rec->save();
$a_mapping->addMapping("Services/Calendar", "recurrence_rule", $a_rec["RuleId"],
$rec->getRecurrenceId());
}
break;
}
}

+ Here is the call graph for this function:

ilCalendarDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters
@return

Definition at line 132 of file class.ilCalendarDataSet.php.

References ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
// calendar
if ($a_entity == "calendar")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT cat_id, obj_id, title, color, type ".
" FROM cal_categories ".
" WHERE ".
$ilDB->in("cat_id", $a_ids, false, "integer"));
break;
}
}
// cal assignments
if ($a_entity == "cal_assignment")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT cat_id, cal_id entry_id ".
" FROM cal_cat_assignments ".
" WHERE ".
$ilDB->in("cat_id", $a_ids, false, "integer"));
break;
}
}
// cal entries
if ($a_entity == "cal_entry")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT cal_id id, title, subtitle, description, location, fullday, ".
" starta, enda, informations, auto_generated, context_id, translation_type, is_milestone, completion, notification ".
" FROM cal_entries ".
" WHERE ".
$ilDB->in("cal_id", $a_ids, false, "integer"));
break;
}
}
// recurrence_rule
if ($a_entity == "recurrence_rule")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT rule_id, cal_id entry_id, cal_recurrence, freq_type, freq_until_date, freq_until_count, ".
" intervall, byday, byweekno, bymonth, bymonthday, byyearday, bysetpos, weekstart ".
" FROM cal_recurrence_rules ".
" WHERE ".
$ilDB->in("cal_id", $a_ids, false, "integer"));
break;
}
}
}

+ Here is the call graph for this function:


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