ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBibliographicDataSet Class Reference

Bibliographic dataset class. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 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, $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 ...> ... </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> 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)
 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()
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

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 10 of file class.ilBibliographicDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilBibliographicDataSet::__construct ( )

Constructor.

Reimplemented from ilDataSet.

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

47 {
48 global $DIC;
49 $ilDB = $DIC['ilDB'];
50 $ilUser = $DIC['ilUser'];
51 parent::__construct();
52 $this->db = $ilDB;
53 $this->user = $ilUser;
54 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7
global $ilDB
$ilUser
Definition: imgupload.php:18

References $DIC, $ilDB, $ilUser, and user().

+ Here is the call graph for this function:

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 175 of file class.ilBibliographicDataSet.php.

176 {
177 switch ($a_entity) {
178 case 'bibl':
179 foreach ($a_ids as $bibl_id) {
180 if (ilObject::_lookupType($bibl_id) == 'bibl') {
181 $obj = new ilObjBibliographic($bibl_id);
182 $data = array(
183 'id' => $bibl_id,
184 'title' => $obj->getTitle(),
185 'description' => $obj->getDescription(),
186 'fileName' => $obj->getFilename(),
187 'is_online' => $obj->getOnline(),
188 );
189 $this->data[] = $data;
190 }
191 }
192 break;
193 default:
194 }
195 }
Class ilObjBibliographic.
static _lookupType($a_id, $a_reference=false)
lookup object type
$this data['403_header']

References $data, ilObject\_lookupType(), and data.

Referenced by readData().

+ 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 202 of file class.ilBibliographicDataSet.php.

203 {
204 $obj = new ilObjBibliographic($a_id);
205 $fileAbsolutePath = $obj->getLegacyAbsolutePath();
206 copy($fileAbsolutePath, $this->absolute_export_dir . "/" . $obj->getFilename());
207 }

◆ 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 146 of file class.ilBibliographicDataSet.php.

147 {
148 return false;
149 }

◆ getSupportedVersions()

ilBibliographicDataSet::getSupportedVersions ( )
Returns
array

Reimplemented from ilDataSet.

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

61 {
62 return array( '4.5.0' );
63 }

◆ 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

Reimplemented from ilDataSet.

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

119 {
120 switch ($a_entity) {
121 case 'bibl':
122 return array(
123 "id" => "integer",
124 "title" => "text",
125 "description" => "text",
126 "filename" => "text",
127 'is_online' => 'integer',
128 );
129 default:
130 return array();
131 }
132 }

◆ getXmlNamespace()

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

Reimplemented from ilDataSet.

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

73 {
74 return 'http://www.ilias.de/xml/Modules/Bibliographic/' . $a_entity;
75 }

◆ importLibraryFile()

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

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

214 {
215 $import_path = $this->getImportDirectory() . "/Modules/Bibliographic/set_1/expDir_1/"
216 . $this->import_bib_object->getFilename();
217 $new_id = $this->import_bib_object->getId();
218 $new_path = ilUtil::getDataDir() . "/bibl/" . $new_id;
219 mkdir($new_path);
220 copy($import_path, $new_path . "/" . $this->import_bib_object->getFilename());
221 }
getImportDirectory()
Get import directory.
static getDataDir()
get data directory (outside webspace)

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

Referenced by importRecord().

+ 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 85 of file class.ilBibliographicDataSet.php.

86 {
87 switch ($a_entity) {
88 case 'bibl':
89 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['id'])) {
90 // container content
91 $new_obj = ilObjectFactory::getInstanceByObjId($new_id, false);
92 } else {
93 $new_obj = new ilObjBibliographic();
94 }
95 $new_obj->setTitle($a_rec['title']);
96 $new_obj->setDescription($a_rec['description']);
97 $new_obj->setFilename($a_rec['fileName']);
98 $new_obj->setOnline(false);
99 if (!$new_obj->getId()) {
100 $new_obj->create();
101 }
102 $this->import_bib_object = $new_obj;
103 $a_mapping->addMapping('Modules/Bibliographic', 'bibl', $a_rec['id'], $new_obj->getId());
104 $this->importLibraryFile($a_mapping);
105 break;
106 }
107 }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

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

+ 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

Reimplemented from ilDataSet.

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

160 {
161 $this->data = array();
162 if (!is_array($a_ids)) {
163 $a_ids = array( $a_ids );
164 }
165 $this->_readData($a_entity, $a_ids);
166 }
_readData($a_entity, $a_ids)
Build data array, data is read from cache except bibl object itself.

References _readData(), and data.

+ 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 31 of file class.ilBibliographicDataSet.php.

◆ $import_temp_refs

ilBibliographicDataSet::$import_temp_refs = array()
protected

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

◆ $import_temp_refs_props

ilBibliographicDataSet::$import_temp_refs_props = array()
protected

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

◆ $record_field_ids_2_storage

ilBibliographicDataSet::$record_field_ids_2_storage = array()
protected

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

◆ $user

ilBibliographicDataSet::$user
protected

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


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