ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 = ""
 

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 ( )

Constructor.

Reimplemented from ilDataSet.

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

45 {
46 global $DIC;
47 $ilDB = $DIC['ilDB'];
48 $ilUser = $DIC['ilUser'];
49 parent::__construct();
50 $this->db = $ilDB;
51 $this->user = $ilUser;
52 }
user()
Definition: user.php:4
global $ilDB
global $DIC
$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 169 of file class.ilBibliographicDataSet.php.

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

References $data, and ilObject\_lookupType().

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

195 {
196 $obj = new ilObjBibliographic($a_id);
197 copy($obj->getFileAbsolutePath(), $this->absolute_export_dir . "/" . $obj->getFilename());
198 }

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

142 {
143 return false;
144 }

◆ getSupportedVersions()

ilBibliographicDataSet::getSupportedVersions ( )
Returns
array

Reimplemented from ilDataSet.

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

58 {
59 return array( '4.5.0' );
60 }

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

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

◆ getXmlNamespace()

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

Reimplemented from ilDataSet.

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

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

◆ importLibraryFile()

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

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

204 {
205 $import_path = $this->getImportDirectory()
206 . "/Modules/Bibliographic/set_1/expDir_1/" . $this->import_bib_object->getFilename();
207 $new_id = $this->import_bib_object->getId();
208 $new_path = ilUtil::getDataDir() . "/bibl/" . $new_id;
209 mkdir($new_path);
210 copy($import_path, $new_path . "/" . $this->import_bib_object->getFilename());
211 // this will write the source file entry to db
212 $this->import_bib_object->update();
213 }
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 81 of file class.ilBibliographicDataSet.php.

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

References $DIC, $ilDB, 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 154 of file class.ilBibliographicDataSet.php.

154 {
155 $this->data = array();
156 if (! is_array($a_ids)) {
157 $a_ids = array( $a_ids );
158 }
159 $this->_readData($a_entity, $a_ids);
160 }
_readData($a_entity, $a_ids)
Build data array, data is read from cache except bibl object itself.

References _readData().

+ 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: