ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSessionDataSet Class Reference

Session data set class. More...

+ Inheritance diagram for ilSessionDataSet:
+ Collaboration diagram for ilSessionDataSet:

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.
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record (export)
 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.
 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

Session 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.ilSessionDataSet.php.

Member Function Documentation

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

Determine the dependent sets of data.

Definition at line 162 of file class.ilSessionDataSet.php.

{
switch ($a_entity)
{
case "sess":
return array (
"sess_item" => array("ids" => $a_rec["Id"])
);
}
return false;
}
ilSessionDataSet::getSupportedVersions ( )

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

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

{
return array("4.1.0");
}
ilSessionDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

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

{
if ($a_entity == "sess")
{
switch ($a_version)
{
case "4.1.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"Location" => "text",
"TutorName" => "text",
"TutorEmail" => "text",
"TutorPhone" => "text",
"Details" => "text",
"Registration" => "integer",
"EventStart" => "text",
"EventEnd" => "text",
"StartingTime" => "integer",
"EndingTime" => "integer",
"Fulltime" => "integer"
);
}
}
if ($a_entity == "sess_item")
{
switch ($a_version)
{
case "4.1.0":
return array(
"SessionId" => "integer",
"ItemId" => "text",
);
}
}
}
ilSessionDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

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

{
return "http://www.ilias.de/xml/Modules/Session/".$a_entity;
}
ilSessionDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record (export)

Parameters
arrayabstract data record
Returns
array xml record

Reimplemented from ilDataSet.

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

References ilObject\_lookupObjId().

{
if ($a_entity == "sess")
{
// convert server dates to utc
if(!$a_set["Fulltime"])
{
// nothing has to be done here, since the dates are already stored in UTC
#$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME);
#$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC');
#$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME);
#$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC');
}
}
if ($a_entity == "sess_item")
{
// make ref id an object id
$a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
}
return $a_set;
}

+ Here is the call graph for this function:

ilSessionDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

Definition at line 182 of file class.ilSessionDataSet.php.

References $ref_id, ilObject\_getAllReferences(), ilEventItems\addItem(), ilObjectFactory\getInstanceByObjId(), IL_CAL_DATETIME, and IL_CAL_UNIX.

{
switch ($a_entity)
{
case "sess":
include_once("./Modules/Session/classes/class.ilObjSession.php");
include_once("./Modules/Session/classes/class.ilSessionAppointment.php");
if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
}
else
{
$newObj = new ilObjSession();
$newObj->setType("sess");
$newObj->create(true);
}
$newObj->setTitle($a_rec["Title"]);
$newObj->setDescription($a_rec["Description"]);
$newObj->setLocation($a_rec["Location"]);
$newObj->setName($a_rec["TutorName"]);
$newObj->setPhone($a_rec["TutorPhone"]);
$newObj->setEmail($a_rec["TutorEmail"]);
$newObj->setDetails($a_rec["Details"]);
$newObj->enableRegistration($a_rec["Registration"]);
$newObj->update();
$start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC");
$end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC");
//echo "<br>".$start->get(IL_CAL_UNIX);
//echo "<br>".$start->get(IL_CAL_DATETIME);
$app = new ilSessionAppointment();
$app->setStart($a_rec["EventStart"]);
$app->setEnd($a_rec["EventEnd"]);
$app->setStartingTime($start->get(IL_CAL_UNIX));
$app->setEndingTime($end->get(IL_CAL_UNIX));
$app->toggleFullTime($a_rec["Fulltime"]);
$app->setSessionId($newObj->getId());
$app->create();
//$newObj->setAppointments(array($app));
//$newObj->update();
$this->current_obj = $newObj;
$a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId());
//var_dump($a_mapping->mappings["Services/News"]["news_context"]);
break;
case "sess_item":
if($obj_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['ItemId']))
{
$ref_id = current(ilObject::_getAllReferences($obj_id));
include_once './Modules/Session/classes/class.ilEventItems.php';
$evi = new ilEventItems($this->current_obj->getId());
$evi->addItem($ref_id);
$evi->update();
}
break;
}
}

+ Here is the call graph for this function:

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

Read data.

Parameters
@return

Definition at line 89 of file class.ilSessionDataSet.php.

References ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
if ($a_entity == "sess")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, od.description description, ".
" location, tutor_name, tutor_email, tutor_phone, details, registration, ".
" e_start event_start, e_end event_end, starting_time, ending_time, fulltime ".
" FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) ".
" JOIN event_appointment ea ON (ev.obj_id = ea.event_id) ".
"WHERE ".
$ilDB->in("ev.obj_id", $a_ids, false, "integer"));
break;
}
}
if ($a_entity == "sess_item")
{
switch ($a_version)
{
case "4.1.0":
$this->getDirectDataFromQuery($q = "SELECT event_id session_id, item_id ".
" FROM event_items ".
"WHERE ".
$ilDB->in("event_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: