ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBookmarkDataSet Class Reference

Bookmarks Data set class. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __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, $a_set=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...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 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...
 

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
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilBookmarkDataSet::__construct ( )

Constructor.

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

References $DIC.

20  {
21  global $DIC;
22 
23  parent::__construct();
24  $this->db = $DIC->database();
25  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

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

130  {
131  switch ($a_entity) {
132  case "bookmarks":
133  return array(
134  "bookmark_tree" => array("ids" => $a_rec["UserId"])
135  );
136  }
137  return false;
138  }

◆ getSupportedVersions()

ilBookmarkDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

34  {
35  return array("4.3.0");
36  }

◆ getTypes()

ilBookmarkDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters

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

56  {
57  // bookmarks
58  if ($a_entity == "bookmarks") {
59  switch ($a_version) {
60  case "4.3.0":
61  return array(
62  "UserId" => "integer"
63  );
64  }
65  }
66 
67  // bookmark_tree
68  if ($a_entity == "bookmark_tree") {
69  switch ($a_version) {
70  case "4.3.0":
71  return array(
72  "UserId" => "integer",
73  "Child" => "integer",
74  "Parent" => "integer",
75  "Depth" => "integer",
76  "Type" => "text",
77  "Title" => "text",
78  "Description" => "text",
79  "Target" => "text"
80  );
81  }
82  }
83  }

◆ getXmlNamespace()

ilBookmarkDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

45  {
46  return "http://www.ilias.de/xml/Services/Bookmarks/" . $a_entity;
47  }

◆ importRecord()

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

Import record.

Parameters

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

References $tree, and ilObject\_lookupType().

152  {
153  switch ($a_entity) {
154  case "bookmarks":
155  break;
156 
157  case "bookmark_tree":
158  $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["UserId"]);
159  if ($usr_id > 0 && ilObject::_lookupType($usr_id) == "usr") {
160  //echo "<br><br>";
161  //var_dump($a_rec);
162  switch ($a_rec["Type"]) {
163  case "bmf":
164  if ($a_rec["Parent"] > 0) {
165  $parent = (int) $a_mapping->getMapping("Services/Bookmarks", "bookmark_tree", $a_rec["Parent"]);
166  include_once("./Services/Bookmarks/classes/class.ilBookmarkFolder.php");
167  $bmf = new ilBookmarkFolder(0, $usr_id);
168  $bmf->setTitle($a_rec["Title"]);
169  $bmf->setParent($parent);
170  $bmf->create();
171  $fold_id = $bmf->getId();
172  } else {
173  $tree = new ilTree($usr_id);
174  $tree->setTableNames('bookmark_tree', 'bookmark_data');
175  $fold_id = $tree->readRootId();
176  }
177  $a_mapping->addMapping(
178  "Services/Bookmarks",
179  "bookmark_tree",
180  $a_rec["Child"],
181  $fold_id
182  );
183  break;
184 
185  case "bm":
186  $parent = 0;
187  if (((int) $a_rec["Parent"]) > 0) {
188  $parent = (int) $a_mapping->getMapping("Services/Bookmarks", "bookmark_tree", $a_rec["Parent"]);
189  } else {
190  return;
191  }
192 
193  if ($parent == 0) {
194  $tree = new ilTree($usr_id);
195  $tree->setTableNames('bookmark_tree', 'bookmark_data');
196  $parent = $tree->readRootId();
197  }
198 //echo "-$parent-";
199  include_once("./Services/Bookmarks/classes/class.ilBookmark.php");
200  $bm = new ilBookmark(0, $usr_id);
201  $bm->setTitle($a_rec["Title"]);
202  $bm->setDescription($a_rec["Description"]);
203  $bm->setTarget($a_rec["Target"]);
204  $bm->setParent($parent);
205  $bm->create();
206  break;
207 
208  }
209  }
210  break;
211  }
212  }
Class Bookmarks Bookmark management.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _lookupType($a_id, $a_reference=false)
lookup object type
bookmark folder (note: this class handles personal bookmarks folders only)
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

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

References ilDataSet\$db, $id, $ilDB, data, and ilDataSet\getDirectDataFromQuery().

92  {
93  $ilDB = $this->db;
94 
95  if (!is_array($a_ids)) {
96  $a_ids = array($a_ids);
97  }
98 
99  // bookmarks
100  if ($a_entity == "bookmarks") {
101  switch ($a_version) {
102  case "4.3.0":
103  $this->data = array();
104  foreach ($a_ids as $id) {
105  $this->data[] = array("UserId" => $id);
106  }
107  break;
108  }
109  }
110 
111  // bookmark_tree
112  if ($a_entity == "bookmark_tree") {
113  switch ($a_version) {
114  case "4.3.0":
115  $this->getDirectDataFromQuery("SELECT tree user_id, child " .
116  " ,parent,depth,type,title,description,target " .
117  " FROM bookmark_tree JOIN bookmark_data ON (child = obj_id) " .
118  " WHERE " .
119  $ilDB->in("tree", $a_ids, false, "integer") .
120  " ORDER BY tree, depth");
121  break;
122  }
123  }
124  }
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
if(!array_key_exists('StateId', $_REQUEST)) $id
$this data['403_header']
global $ilDB
+ Here is the call graph for this function:

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