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

Bookmarks Data set class. More...

+ Inheritance diagram for ilBookmarkDataSet:
+ Collaboration diagram for ilBookmarkDataSet:

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

Bookmarks 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.ilBookmarkDataSet.php.

Member Function Documentation

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

Determine the dependent sets of data.

Definition at line 127 of file class.ilBookmarkDataSet.php.

{
switch ($a_entity)
{
case "bookmarks":
return array (
"bookmark_tree" => array("ids" => $a_rec["UserId"])
);
}
return false;
}
ilBookmarkDataSet::getSupportedVersions ( )

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

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

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

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

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

{
// bookmarks
if ($a_entity == "bookmarks")
{
switch ($a_version)
{
case "4.3.0":
return array(
"UserId" => "integer"
);
}
}
// bookmark_tree
if ($a_entity == "bookmark_tree")
{
switch ($a_version)
{
case "4.3.0":
return array(
"UserId" => "integer",
"Child" => "integer",
"Parent" => "integer",
"Depth" => "integer",
"Type" => "text",
"Title" => "text",
"Description" => "text",
"Target" => "text"
);
}
}
}
ilBookmarkDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

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

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

Import record.

Parameters
@return

Definition at line 150 of file class.ilBookmarkDataSet.php.

References $usr_id, and ilObject\_lookupType().

{
switch ($a_entity)
{
case "bookmarks":
break;
case "bookmark_tree":
$usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["UserId"]);
if ($usr_id > 0 && ilObject::_lookupType($usr_id) == "usr")
{
//echo "<br><br>";
//var_dump($a_rec);
switch ($a_rec["Type"])
{
case "bmf":
if ($a_rec["Parent"] > 0)
{
$parent = (int) $a_mapping->getMapping("Services/Bookmarks", "bookmark_tree", $a_rec["Parent"]);
include_once("./Services/Bookmarks/classes/class.ilBookmarkFolder.php");
$bmf = new ilBookmarkFolder(0, $usr_id);
$bmf->setTitle($a_rec["Title"]);
$bmf->setParent($parent);
$bmf->create();
$fold_id = $bmf->getId();
}
else
{
$tree = new ilTree($usr_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
$fold_id = $tree->readRootId();
}
$a_mapping->addMapping("Services/Bookmarks", "bookmark_tree", $a_rec["Child"],
$fold_id);
break;
case "bm":
$parent = 0;
if (((int) $a_rec["Parent"]) > 0)
{
$parent = (int) $a_mapping->getMapping("Services/Bookmarks", "bookmark_tree", $a_rec["Parent"]);
}
else
{
return;
}
if ($parent == 0)
{
$tree = new ilTree($usr_id);
$tree->setTableNames('bookmark_tree','bookmark_data');
$parent = $tree->readRootId();
}
//echo "-$parent-";
include_once("./Services/Bookmarks/classes/class.ilBookmark.php");
$bm = new ilBookmark(0, $usr_id);
$bm->setTitle($a_rec["Title"]);
$bm->setDescription($a_rec["Description"]);
$bm->setTarget($a_rec["Target"]);
$bm->setParent($parent);
$bm->create();
break;
}
}
break;
}
}

+ Here is the call graph for this function:

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

Read data.

Parameters
@return

Definition at line 83 of file class.ilBookmarkDataSet.php.

References ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
// bookmarks
if ($a_entity == "bookmarks")
{
switch ($a_version)
{
case "4.3.0":
$this->data = array();
foreach ($a_ids as $id)
{
$this->data[] = array("UserId" => $id);
}
break;
}
}
// bookmark_tree
if ($a_entity == "bookmark_tree")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT tree user_id, child ".
" ,parent,depth,type,title,description,target ".
" FROM bookmark_tree JOIN bookmark_data ON (child = obj_id) ".
" WHERE ".
$ilDB->in("tree", $a_ids, false, "integer").
" ORDER BY tree, depth");
break;
}
}
}

+ Here is the call graph for this function:


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