ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBibliographicDataSet Class Reference

Bibliographic dataset class. More...

+ Inheritance diagram for ilBibliographicDataSet:
+ Collaboration diagram for ilBibliographicDataSet:

Public Member Functions

 __construct ()
 
 getSupportedVersions ()
 
 getXmlNamespace ($a_entity, $a_schema_version)
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from Cache for a given entity and ID(s) More...
 
 exportLibraryFile ($a_id)
 
 importLibraryFile ($a_mapping)
 
- 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)
 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...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Map XML attributes of entities to datatypes (text, integer...) More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Return dependencies form entities to other entities (in our case these are all the DB relations) More...
 
 _readData ($a_entity, $a_ids)
 Build data array, data is read from cache except bibl object itself. 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...
 

Protected Attributes

 $db
 
 $data = array()
 
 $record_field_ids_2_storage = array()
 
 $import_bib_object
 
 $user
 
 $import_temp_refs = array()
 
 $import_temp_refs_props = array()
 

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

Bibliographic dataset class.

Author
Theodor Truffer tt@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 11 of file class.ilBibliographicDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilBibliographicDataSet::__construct ( )

Definition at line 45 of file class.ilBibliographicDataSet.php.

References $ilDB, and $ilUser.

45  {
46  global $ilDB, $ilUser;
47  parent::__construct();
48  $this->db = $ilDB;
49  $this->user = $ilUser;
50  }
global $ilUser
Definition: imgupload.php:15
global $ilDB

Member Function Documentation

◆ _readData()

ilBibliographicDataSet::_readData (   $a_entity,
  $a_ids 
)
protected

Build data array, data is read from cache except bibl object itself.

Parameters
string$a_entity
array$a_ids

Definition at line 166 of file class.ilBibliographicDataSet.php.

References $data, and ilObject\_lookupType().

Referenced by readData().

166  {
167  switch ($a_entity) {
168  case 'bibl':
169  foreach ($a_ids as $bibl_id) {
170  if (ilObject::_lookupType($bibl_id) == 'bibl') {
171  $obj = new ilObjBibliographic($bibl_id);
172  $data = array(
173  'id' => $bibl_id,
174  'title' => $obj->getTitle(),
175  'description' => $obj->getDescription(),
176  'fileName' => $obj->getFilename(),
177  'is_online' => $obj->getOnline(),
178  );
179  $this->data[] = $data;
180  }
181  }
182  break;
183  default:
184  }
185  }
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjBibliographic.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportLibraryFile()

ilBibliographicDataSet::exportLibraryFile (   $a_id)
Parameters
int$a_id

Definition at line 192 of file class.ilBibliographicDataSet.php.

192  {
193  $obj = new ilObjBibliographic($a_id);
194  copy($obj->getFileAbsolutePath(), $this->absolute_export_dir . "/" . $obj->getFilename());
195  }
Class ilObjBibliographic.

◆ getDependencies()

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

Return dependencies form entities to other entities (in our case these are all the DB relations)

Parameters
string$a_entity
string$a_version
array$a_rec
array$a_ids
Returns
array

Definition at line 139 of file class.ilBibliographicDataSet.php.

139  {
140  return false;
141  }

◆ getSupportedVersions()

ilBibliographicDataSet::getSupportedVersions ( )
Returns
array

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

56  {
57  return array( '4.5.0' );
58  }

◆ getTypes()

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

Map XML attributes of entities to datatypes (text, integer...)

Parameters
string$a_entity
string$a_version
Returns
array

Definition at line 113 of file class.ilBibliographicDataSet.php.

113  {
114  switch ($a_entity) {
115  case 'bibl':
116  return array(
117  "id" => "integer",
118  "title" => "text",
119  "description" => "text",
120  "filename" => "text",
121  'is_online' => 'integer',
122  );
123  default:
124  return array();
125  }
126  }

◆ getXmlNamespace()

ilBibliographicDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)
Parameters
string$a_entity
string$a_schema_version
Returns
string

Definition at line 67 of file class.ilBibliographicDataSet.php.

67  {
68  return 'http://www.ilias.de/xml/Modules/Bibliographic/' . $a_entity;
69  }

◆ importLibraryFile()

ilBibliographicDataSet::importLibraryFile (   $a_mapping)
Parameters
ilImportMapping$a_mapping

Definition at line 201 of file class.ilBibliographicDataSet.php.

References ilUtil\getDataDir(), and ilDataSet\getImportDirectory().

Referenced by importRecord().

201  {
202  $import_path = $this->getImportDirectory()
203  . "/Modules/Bibliographic/set_1/expDir_1/" . $this->import_bib_object->getFilename();
204  $new_id = $this->import_bib_object->getId();
205  $new_path = ilUtil::getDataDir() . "/bibl/" . $new_id;
206  mkdir($new_path);
207  copy($import_path, $new_path . "/" . $this->import_bib_object->getFilename());
208  // this will write the source file entry to db
209  $this->import_bib_object->update();
210  }
getImportDirectory()
Get import directory.
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importRecord()

ilBibliographicDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)
Parameters
string$a_entity
$a_types
array$a_rec
ilImportMapping$a_mapping
string$a_schema_version

Definition at line 79 of file class.ilBibliographicDataSet.php.

References $ilDB, ilObjectFactory\getInstanceByObjId(), and importLibraryFile().

79  {
80  global $ilDB;
81  switch ($a_entity) {
82  case 'bibl':
83  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['id']))
84  {
85  // container content
86  $new_obj = ilObjectFactory::getInstanceByObjId($new_id,false);
87  } else {
88  $new_obj = new ilObjBibliographic();
89  }
90  $new_obj->setTitle($a_rec['title']);
91  $new_obj->setDescription($a_rec['description']);
92  $new_obj->setFilename($a_rec['fileName']);
93  $new_obj->setOnline(false);
94  if (!$new_obj->getId()) {
95  $new_obj->create();
96  }
97  $this->import_bib_object = $new_obj;
98  $a_mapping->addMapping('Modules/Bibliographic', 'bibl', $a_rec['id'], $new_obj->getId());
99  $this->importLibraryFile($a_mapping);
100  break;
101  }
102  }
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
global $ilDB
Class ilObjBibliographic.
+ Here is the call graph for this function:

◆ readData()

ilBibliographicDataSet::readData (   $a_entity,
  $a_version,
  $a_ids 
)

Read data from Cache for a given entity and ID(s)

Parameters
string$a_entity
string$a_version
array$a_idsone or multiple ids

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

References _readData().

151  {
152  $this->data = array();
153  if (! is_array($a_ids)) {
154  $a_ids = array( $a_ids );
155  }
156  $this->_readData($a_entity, $a_ids);
157  }
_readData($a_entity, $a_ids)
Build data array, data is read from cache except bibl object itself.
+ Here is the call graph for this function:

Field Documentation

◆ $data

ilBibliographicDataSet::$data = array()
protected

Definition at line 20 of file class.ilBibliographicDataSet.php.

Referenced by _readData().

◆ $db

ilBibliographicDataSet::$db
protected

Definition at line 16 of file class.ilBibliographicDataSet.php.

◆ $import_bib_object

ilBibliographicDataSet::$import_bib_object
protected

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

◆ $import_temp_refs

ilBibliographicDataSet::$import_temp_refs = array()
protected

Definition at line 38 of file class.ilBibliographicDataSet.php.

◆ $import_temp_refs_props

ilBibliographicDataSet::$import_temp_refs_props = array()
protected

Definition at line 42 of file class.ilBibliographicDataSet.php.

◆ $record_field_ids_2_storage

ilBibliographicDataSet::$record_field_ids_2_storage = array()
protected

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

◆ $user

ilBibliographicDataSet::$user
protected

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


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