ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataSet Class Reference

A dataset contains in data in a common structure that can be shared and transformed for different purposes easily, examples. More...

+ Inheritance diagram for ilDataSet:
+ Collaboration diagram for ilDataSet:

Public Member Functions

 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 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. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 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 ...> ... More...
 
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 

Data Fields

 $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
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=NULL)
 Parse export id. More...
 

Private Member Functions

 addTypesXml ($a_writer, $a_entity, $a_schema_version)
 Add types to xml writer. More...
 

Detailed Description

A dataset contains in data in a common structure that can be shared and transformed for different purposes easily, examples.

  • transform associative arrays into (set-)xml and back (e.g. for import/export)
  • transform assiciative arrays into json and back (e.g. for ajax requests)

The general structure is:

  • entity name (many times this corresponds to a table name)
  • structure (this is a set of field names and types pairs) currently supported types: text, integer, timestamp planned: date, time, clob types correspond to db types, see http://www.ilias.de/docu/goto.php?target=pg_25354_42&client_id=docu
  • records (similar to records of a database query; associative arrays)
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 24 of file class.ilDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilDataSet::__construct ( )

Constructor.

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

41  {
42  }

Member Function Documentation

◆ addRecordsXml()

ilDataSet::addRecordsXml (   $a_writer,
  $a_prefixes,
  $a_entity,
  $a_schema_version,
  $a_ids,
  $a_field = "" 
)

Add records xml.

Parameters

Definition at line 308 of file class.ilDataSet.php.

References $d, $dircnt, afterXmlRecordWriting(), getDSPrefixString(), getXmlRecord(), getXmlTypes(), ilUtil\makeDirParents(), ilUtil\rCopy(), and readData().

Referenced by getXmlRepresentation().

309  {
310  $types = $this->getXmlTypes($a_entity, $a_schema_version);
311 
312  $this->readData($a_entity, $a_schema_version, $a_ids, $a_field);
313  if (is_array($this->data))
314  {
315  foreach ($this->data as $d)
316  {
317  $a_writer->xmlStartTag($this->getDSPrefixString()."Rec",
318  array("Entity" => $this->getXmlEntityName($a_entity, $a_schema_version)));
319 
320  // entity tag
321  $a_writer->xmlStartTag($this->getXmlEntityTag($a_entity, $a_schema_version));
322 
323  $rec = $this->getXmlRecord($a_entity, $a_schema_version, $d);
324  foreach ($rec as $f => $c)
325  {
326  switch ($types[$f])
327  {
328  case "directory":
329  if ($this->absolute_export_dir != "" && $this->relative_export_dir != "")
330  {
331  ilUtil::makeDirParents($this->absolute_export_dir."/dsDir_".$this->dircnt);
332  ilUtil::rCopy($c, $this->absolute_export_dir."/dsDir_".$this->dircnt);
333 //echo "<br>copy-".$c."-".$this->absolute_export_dir."/dsDir_".$this->dircnt."-";
334  $c = $this->relative_export_dir."/dsDir_".$this->dircnt;
335  $this->dircnt++;
336  }
337  break;
338  }
339  // this changes schema/dtd
340  //$a_writer->xmlElement($a_prefixes[$a_entity].":".$f,
341  // array(), $c);
342  $a_writer->xmlElement($f, array(), $c);
343  }
344 
345  $a_writer->xmlEndTag($this->getXmlEntityTag($a_entity, $a_schema_version));
346 
347  $a_writer->xmlEndTag($this->getDSPrefixString()."Rec");
348 
349  $this->afterXmlRecordWriting($a_entity, $a_schema_version, $d);
350 
351  // foreach record records of dependent entities (no record)
352  $deps = $this->getDependencies($a_entity, $a_schema_version, $rec, $a_ids);
353  if (is_array($deps))
354  {
355  foreach ($deps as $dp => $par)
356  {
357  $this->addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par["ids"], $par["field"]);
358  }
359  }
360  }
361  }
362  else if ($this->data === false)
363  {
364  // false -> add records of dependent entities (no record)
365  $deps = $this->getDependencies($a_entity, $a_schema_version, null, $a_ids);
366  if (is_array($deps))
367  {
368  foreach ($deps as $dp => $par)
369  {
370  $this->addRecordsXml($a_writer, $a_prefixes, $dp, $a_schema_version, $par["ids"], $par["field"]);
371  }
372  }
373  }
374  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
afterXmlRecordWriting($a_entity, $a_version, $a_set)
After xml record writing hook record.
readData($a_entity, $a_version, $a_ids)
Read data from DB.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record for version.
getXmlTypes($a_entity, $a_version)
Get xml types.
addRecordsXml($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
Add records xml.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTypesXml()

ilDataSet::addTypesXml (   $a_writer,
  $a_entity,
  $a_schema_version 
)
private

Add types to xml writer.

Parameters

Definition at line 391 of file class.ilDataSet.php.

References $t, getDSPrefixString(), and getXmlTypes().

Referenced by getXmlRepresentation().

392  {
393  $types = $this->getXmlTypes($a_entity, $a_schema_version);
394 
395  // add types of current entity
396  if (is_array($types))
397  {
398  $a_writer->xmlStartTag($this->getDSPrefixString()."Types",
399  array("Entity" => $this->getXmlEntityName($a_entity, $a_schema_version),
400  "SchemaVersion" => $a_schema_version));
401  foreach ($this->getXmlTypes($a_entity, $a_schema_version) as $f => $t)
402  {
403  $a_writer->xmlElement($this->getDSPrefixString().'FieldType',
404  array("Name" => $f, "Type" => $t));
405  }
406  $a_writer->xmlEndTag($this->getDSPrefixString()."Types");
407  }
408 
409  // add types of dependent entities
410  $deps = $this->getDependencies($a_entity, $a_schema_version, null, null);
411  if (is_array($deps))
412  {
413  foreach ($deps as $dp => $w)
414  {
415  $this->addTypesXml($a_writer, $dp, $a_schema_version);
416  }
417  }
418 
419  }
addTypesXml($a_writer, $a_entity, $a_schema_version)
Add types to xml writer.
getXmlTypes($a_entity, $a_version)
Get xml types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterXmlRecordWriting()

ilDataSet::afterXmlRecordWriting (   $a_entity,
  $a_version,
  $a_set 
)

After xml record writing hook record.

Parameters

Definition at line 382 of file class.ilDataSet.php.

Referenced by addRecordsXml().

383  {
384  }
+ Here is the caller graph for this function:

◆ convertToLeadingUpper()

ilDataSet::convertToLeadingUpper (   $a_str)

Make xyz_abc a XyzAbc string.

Parameters

Definition at line 190 of file class.ilDataSet.php.

Referenced by getDirectDataFromQuery(), getXMLEntityTag(), and ilUserDataSet\importRecord().

191  {
192  $a_str = strtoupper(substr($a_str, 0, 1)).substr($a_str, 1);
193  while (is_int($pos = strpos($a_str, "_")))
194  {
195  $a_str = substr($a_str, 0, $pos).
196  strtoupper(substr($a_str, $pos+1, 1)).
197  substr($a_str, $pos+2);
198  }
199  return $a_str;
200  }
+ Here is the caller graph for this function:

◆ createObjectExportId()

ilDataSet::createObjectExportId (   $a_type,
  $a_id 
)
protected

Build ilias export id.

Parameters
string$a_type
int$a_id
Returns
string

Definition at line 546 of file class.ilDataSet.php.

Referenced by ilBlogDataSet\readData().

547  {
548  return "il_".IL_INST_ID."_".$a_type."_".$a_id;
549  }
+ Here is the caller graph for this function:

◆ getDirectDataFromQuery()

ilDataSet::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.

Parameters

Definition at line 161 of file class.ilDataSet.php.

References convertToLeadingUpper().

Referenced by ilExternalFeedDataSet\readData(), ilHTMLLearningModuleDataSet\readData(), ilMediaCastDataSet\readData(), ilRatingDataSet\readData(), ilCOPageDataSet\readData(), ilNewsDataSet\readData(), ilNotesDataSet\readData(), ilItemGroupDataSet\readData(), ilPollDataSet\readData(), ilBookmarkDataSet\readData(), ilHelpDataSet\readData(), ilPortfolioDataSet\readData(), ilBlogDataSet\readData(), ilMediaPoolDataSet\readData(), ilSessionDataSet\readData(), ilExerciseDataSet\readData(), ilTaxonomyDataSet\readData(), ilWikiDataSet\readData(), ilCalendarDataSet\readData(), ilMediaObjectDataSet\readData(), and ilUserDataSet\readData().

162  {
163  global $ilDB;
164 
165  $set = $ilDB->query($a_query);
166  $this->data = array();
167  while ($rec = $ilDB->fetchAssoc($set))
168  {
169  if ($a_convert_to_leading_upper)
170  {
171  $tmp = array();
172  foreach ($rec as $k => $v)
173  {
174  $tmp[$this->convertToLeadingUpper($k)]
175  = $v;
176  }
177  $rec = $tmp;
178  }
179 
180  $this->data[] = $rec;
181  }
182  }
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDSPrefix()

ilDataSet::getDSPrefix ( )

Get XML dataset namespace prefix.

Returns
string XML dataset namespace prefix

Definition at line 141 of file class.ilDataSet.php.

Referenced by getDSPrefixString().

142  {
143  return $this->var;
144  }
+ Here is the caller graph for this function:

◆ getDSPrefixString()

ilDataSet::getDSPrefixString ( )

Definition at line 146 of file class.ilDataSet.php.

References getDSPrefix().

Referenced by addRecordsXml(), addTypesXml(), and getXmlRepresentation().

147  {
148  if ($this->getDSPrefix() != "")
149  {
150  return $this->getDSPrefix().":";
151  }
152  }
getDSPrefix()
Get XML dataset namespace prefix.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImport()

ilDataSet::getImport ( )

Get import object.

Returns
object import object

Definition at line 534 of file class.ilDataSet.php.

535  {
536  return $this->import;
537  }

◆ getImportDirectory()

ilDataSet::getImportDirectory ( )

Get import directory.

Returns
string import directory

Definition at line 121 of file class.ilDataSet.php.

Referenced by ilHTMLLearningModuleDataSet\importRecord(), ilPollDataSet\importRecord(), ilPortfolioDataSet\importRecord(), ilBlogDataSet\importRecord(), ilExerciseDataSet\importRecord(), ilUserDataSet\importRecord(), and ilMediaObjectDataSet\importRecord().

122  {
123  return $this->import_directory;
124  }
+ Here is the caller graph for this function:

◆ getJsonEntityName()

ilDataSet::getJsonEntityName (   $a_entity,
  $a_version 
)

Get entity name for json (may be overwritten)

Definition at line 514 of file class.ilDataSet.php.

Referenced by getJsonRepresentation().

515  {
516  return $a_entity;
517  }
+ Here is the caller graph for this function:

◆ getJsonRecord()

ilDataSet::getJsonRecord (   $a_set)

Get json record for version.

Parameters
arrayabstract data record
Returns
array json record

Definition at line 463 of file class.ilDataSet.php.

Referenced by getJsonRepresentation().

464  {
465  return $a_set;
466  }
+ Here is the caller graph for this function:

◆ getJsonRepresentation()

ilDataSet::getJsonRepresentation ( )
final

Get json representation.

Definition at line 206 of file class.ilDataSet.php.

References $d, ilJsonUtil\encode(), getJsonEntityName(), getJsonRecord(), and getJsonTypes().

207  {
208  if ($this->version === false)
209  {
210  return false;
211  }
212 
213  $arr["entity"] = $this->getJsonEntityName();
214  $arr["version"] = $this->version;
215  $arr["install_id"] = IL_INST_ID;
216  $arr["install_url"] = ILIAS_HTTP_PATH;
217  $arr["types"] = $this->getJsonTypes();
218  $arr["set"] = array();
219  foreach ($this->data as $d)
220  {
221  $arr["set"][] = $this->getJsonRecord($d);
222  }
223 
224  include_once("./Services/JSON/classes/class.ilJsonUtil.php");
225 
226  return ilJsonUtil::encode($arr);
227  }
getJsonEntityName($a_entity, $a_version)
Get entity name for json (may be overwritten)
getJsonTypes($a_entity, $a_version)
Get json types.
static encode($mixed, $suppress_native=false)
getJsonRecord($a_set)
Get json record for version.
+ Here is the call graph for this function:

◆ getJsonTypes()

ilDataSet::getJsonTypes (   $a_entity,
  $a_version 
)

Get json types.

Returns
array types array for json/version set in constructor

Definition at line 483 of file class.ilDataSet.php.

References getTypes().

Referenced by getJsonRepresentation().

484  {
485  return $this->getTypes($a_entity, $a_version);
486  }
getTypes($a_entity, $a_version)
Get (abstract) types for (abstract) field names.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNamespaces()

ilDataSet::getNamespaces ( $namespaces,
  $a_entity,
  $a_schema_version 
)

Get xml namespaces.

Parameters
arraynamespaces per entity
stringentity
stringtarget release

Definition at line 428 of file class.ilDataSet.php.

References getXmlNamespace().

Referenced by getXmlRepresentation().

429  {
430  $ns = $this->getXmlNamespace($a_entity, $a_schema_version);
431  if ($ns != "")
432  {
433  $namespaces[$a_entity] = $ns;
434  }
435  // add types of dependent entities
436  $deps = $this->getDependencies($a_entity, $a_schema_version, null, null);
437  if (is_array($deps))
438  {
439  foreach ($deps as $dp => $w)
440  {
441  $this->getNamespaces($namespaces, $dp, $a_schema_version);
442  }
443  }
444  }
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getNamespaces(&$namespaces, $a_entity, $a_schema_version)
Get xml namespaces.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSupportedVersions()

ilDataSet::getSupportedVersions ( )
abstract

Get supported version.

Returns
array array of supported version

Referenced by init().

+ Here is the caller graph for this function:

◆ getTypes()

ilDataSet::getTypes (   $a_entity,
  $a_version 
)
abstractprotected

Get (abstract) types for (abstract) field names.

Please note that the abstract fields/types only depend on the version! Not on a choosen representation!

Returns
array types array, e.g. array("field_1" => "text", "field_2" => "integer", ...)

Referenced by getJsonTypes(), getXmlTypes(), and init().

+ Here is the caller graph for this function:

◆ getXMLEntityName()

ilDataSet::getXMLEntityName (   $a_entity,
  $a_version 
)

Get entity name for xml (may be overwritten)

Returns
string

Definition at line 494 of file class.ilDataSet.php.

495  {
496  return $a_entity;
497  }

◆ getXMLEntityTag()

ilDataSet::getXMLEntityTag (   $a_entity,
  $a_schema_version 
)

Get entity tag.

Parameters

Definition at line 505 of file class.ilDataSet.php.

References convertToLeadingUpper().

506  {
507  return $this->convertToLeadingUpper($a_entity);
508  }
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
+ Here is the call graph for this function:

◆ getXmlNamespace()

ilDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)
abstractprotected

Get xml namespace.

Referenced by getNamespaces(), and init().

+ Here is the caller graph for this function:

◆ getXmlRecord()

ilDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record for version.

Parameters
arrayabstract data record
Returns
array xml record

Definition at line 452 of file class.ilDataSet.php.

Referenced by addRecordsXml().

453  {
454  return $a_set;
455  }
+ Here is the caller graph for this function:

◆ getXmlRepresentation()

ilDataSet::getXmlRepresentation (   $a_entity,
  $a_schema_version,
  $a_ids,
  $a_field = "",
  $a_omit_header = false,
  $a_omit_types = false 
)
final

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 ...> ...

</types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset>

Definition at line 250 of file class.ilDataSet.php.

References addRecordsXml(), addTypesXml(), getDSPrefixString(), and getNamespaces().

252  {
253  $this->dircnt = 1;
254 
255  // step 1: check target release and supported versions
256 
257 
258 
259  // step 2: init writer
260  include_once "./Services/Xml/classes/class.ilXmlWriter.php";
261  $writer = new ilXmlWriter();
262  if (!$a_omit_header)
263  {
264  $writer->xmlHeader();
265  }
266 
267  // collect namespaces
268  $namespaces = $prefixes = array();
269  $this->getNamespaces($namespaces, $a_entity, $a_schema_version);
270  $atts = array("InstallationId" => IL_INST_ID,
271  "InstallationUrl" => ILIAS_HTTP_PATH, "TopEntity" => $a_entity);
272  $cnt = 1;
273  foreach ($namespaces as $entity => $ns)
274  {
275  $prefix = "ns".$cnt;
276  $prefixes[$entity] = $prefix;
277 // $atts["xmlns:".$prefix] = $ns;
278  $cnt++;
279  }
280 
281  $writer->xmlStartTag($this->getDSPrefixString().'DataSet', $atts);
282 
283  // add types
284  if (!$a_omit_types)
285  {
286  $this->addTypesXml($writer, $a_entity, $a_schema_version);
287  }
288 
289  // add records
290  $this->addRecordsXml($writer, $prefixes, $a_entity, $a_schema_version, $a_ids, $a_field = "");
291 
292 
293  $writer->xmlEndTag($this->getDSPrefixString()."DataSet");
294 //if ($a_entity == "mep")
295 //{
296 // echo "<pre>".htmlentities($writer->xmlDumpMem(true))."</pre>"; exit;
297 //}
298  return $writer->xmlDumpMem(false);
299  }
XML writer class.
addTypesXml($a_writer, $a_entity, $a_schema_version)
Add types to xml writer.
getNamespaces(&$namespaces, $a_entity, $a_schema_version)
Get xml namespaces.
addRecordsXml($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
Add records xml.
+ Here is the call graph for this function:

◆ getXmlTypes()

ilDataSet::getXmlTypes (   $a_entity,
  $a_version 
)

Get xml types.

Returns
array types array for xml/version set in constructor

Definition at line 473 of file class.ilDataSet.php.

References getTypes().

Referenced by addRecordsXml(), and addTypesXml().

474  {
475  return $this->getTypes($a_entity, $a_version);
476  }
getTypes($a_entity, $a_version)
Get (abstract) types for (abstract) field names.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilDataSet::init (   $a_entity,
  $a_schema_version 
)
final

Init.

Parameters
string(abstract) entity name
stringversion string, always the ILIAS release versions that defined the a structure or made changes to it, never use another version. Example: structure is defined in 4.1.0 and changed in 4.3.0 -> use these values only, not 4.2.0 (ask for the 4.1.0 version in ILIAS 4.2.0)

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

References getSupportedVersions(), getTypes(), getXmlNamespace(), and readData().

57  {
58  $this->entity = $a_entity;
59  $this->schema_version = $a_schema_version;
60  $this->data = array();
61  }
+ Here is the call graph for this function:

◆ parseObjectExportId()

ilDataSet::parseObjectExportId (   $a_id,
  $a_fallback_id = NULL 
)
protected

Parse export id.

Parameters
string$a_id
int$a_fallback_id
Returns
array type, id

Definition at line 558 of file class.ilDataSet.php.

References ilObject\_getIdForImportId(), and ilObject\_lookupType().

Referenced by ilBlogDataSet\importRecord().

559  {
560  // ilias export id?
561  if(substr($a_id, 0, 3) == "il_")
562  {
563  $parts = explode("_", $a_id);
564  $inst_id = $parts[1];
565  $type = $parts[2];
566  $id = $parts[3];
567 
568  // missing installation ids?
569  if(($inst_id == 0 || IL_INST_ID == 0) && !DEVMODE)
570  {
571  return array("type"=>self::EXPORT_NO_INST_ID, "id"=>$a_fallback_id);
572  }
573 
574  // same installation?
575  if($inst_id == IL_INST_ID)
576  {
577  // still existing?
578  if(ilObject::_lookupType($id) == $type)
579  {
580  return array("type"=>self::EXPORT_ID_ILIAS_LOCAL, "id"=>$id);
581  }
582  // not found
583  else
584  {
585  return array("type"=>self::EXPORT_ID_ILIAS_LOCAL_INVALID, "id"=>$a_fallback_id);
586  }
587  }
588  // different installation
589  else
590  {
591  $id = ilObject::_getIdForImportId($a_id);
592  // matching type?
593  if($id && ilObject::_lookupType($id) == $type)
594  {
595  return array("type"=>self::EXPORT_ID_ILIAS_REMOTE, "id"=>$id);
596  }
597  // not found
598  else
599  {
600  return array("type"=>self::EXPORT_ID_ILIAS_REMOTE_INVALID, "id"=>$a_fallback_id);
601  }
602  }
603  }
604 
605  // external id
606  $id = ilObject::_getIdForImportId($a_id);
607  if($id)
608  {
609  return array("type"=>self::EXPORT_ID, "id"=>$id);
610  }
611  else
612  {
613  return array("type"=>self::EXPORT_ID_INVALID, "id"=>$a_fallback_id);
614  }
615  }
_getIdForImportId($a_import_id)
get current object id for import id (static)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readData()

ilDataSet::readData (   $a_entity,
  $a_version,
  $a_ids 
)
abstract

Read data from DB.

This should result in the abstract field structure of the version set in the constructor.

Parameters
arrayone or multiple ids

Referenced by addRecordsXml(), and init().

+ Here is the caller graph for this function:

◆ setDSPrefix()

ilDataSet::setDSPrefix (   $a_val)

Set XML dataset namespace prefix.

Parameters
stringXML dataset namespace prefix

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

132  {
133  $this->var = $a_val;
134  }

◆ setExportDirectories()

ilDataSet::setExportDirectories (   $a_relative,
  $a_absolute 
)

Set export directories.

Parameters

Definition at line 100 of file class.ilDataSet.php.

101  {
102  $this->relative_export_dir = $a_relative;
103  $this->absolute_export_dir = $a_absolute;
104  }

◆ setImport()

ilDataSet::setImport (   $a_val)

Set import object.

Parameters
objectimport object

Definition at line 524 of file class.ilDataSet.php.

525  {
526  $this->import = $a_val;
527  }

◆ setImportDirectory()

ilDataSet::setImportDirectory (   $a_val)

Set import directory.

Parameters
stringimport directory

Definition at line 111 of file class.ilDataSet.php.

112  {
113  $this->import_directory = $a_val;
114  }

Field Documentation

◆ $dircnt

ilDataSet::$dircnt

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

Referenced by addRecordsXml().

◆ EXPORT_ID

const ilDataSet::EXPORT_ID = 6

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

◆ EXPORT_ID_ILIAS_LOCAL

const ilDataSet::EXPORT_ID_ILIAS_LOCAL = 2

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

◆ EXPORT_ID_ILIAS_LOCAL_INVALID

const ilDataSet::EXPORT_ID_ILIAS_LOCAL_INVALID = 3

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

◆ EXPORT_ID_ILIAS_REMOTE

const ilDataSet::EXPORT_ID_ILIAS_REMOTE = 4

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

◆ EXPORT_ID_ILIAS_REMOTE_INVALID

const ilDataSet::EXPORT_ID_ILIAS_REMOTE_INVALID = 5

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

◆ EXPORT_ID_INVALID

const ilDataSet::EXPORT_ID_INVALID = 7

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

◆ EXPORT_NO_INST_ID

const ilDataSet::EXPORT_NO_INST_ID = 1

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


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