ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilBibliographicEntry Class Reference

Class ilBibliographicEntry. More...

+ Collaboration diagram for ilBibliographicEntry:

Public Member Functions

 doCreate ()
 
 doRead ()
 
 doUpdate ()
 
 doDelete ()
 
 setAttributes ($attributes)
 
 getAttributes ()
 
 initOverviewHTML ()
 
 getOverview ()
 
 setOverview ($overview)
 
 setBibliographicObjId ($bibliographic_obj_id)
 
 getBibliographicObjId ()
 
 setEntryId ($entry_id)
 
 getEntryId ()
 
 setType ($type)
 
 getType ()
 
 getFileType ()
 
 setFileType ($file_type)
 

Static Public Member Functions

static getInstance ($file_type, $entry_id=NULL)
 
static getAllEntries ($object_id)
 Read all entries from the database. More...
 

Protected Member Functions

 __construct ($file_type, $entry_id=NULL)
 
 loadAttributes ()
 Reads all the entrys attributes from database. More...
 

Protected Attributes

 $bibliographic_obj_id
 
 $entry_id
 
 $type
 
 $attributes
 
 $file_type
 
 $overview = ''
 

Static Protected Attributes

static $instances = array()
 

Detailed Description

Class ilBibliographicEntry.

Author
Gabriel Comte
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
Id
class.ilBibliographicEntry.php 2012-11-15 16:11:42Z gcomte

Definition at line 12 of file class.ilBibliographicEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ilBibliographicEntry::__construct (   $file_type,
  $entry_id = NULL 
)
protected
Parameters
$file_type
null$entry_id

Definition at line 77 of file class.ilBibliographicEntry.php.

References $entry_id, $file_type, doRead(), and setEntryId().

+ Here is the call graph for this function:

Member Function Documentation

◆ doCreate()

ilBibliographicEntry::doCreate ( )

Definition at line 86 of file class.ilBibliographicEntry.php.

86 {
87 global $ilDB;
88 //auto-increment il_bibl_entry
89 $this->setEntryId($ilDB->nextID('il_bibl_entry'));
90 //table il_bibl_entry
91 $ilDB->manipulate("INSERT INTO il_bibl_entry " . "(data_id, id, type) VALUES (" . $ilDB->quote($this->getBibliographicObjId(), "integer")
92 . "," . // data_id
93 $ilDB->quote($this->getEntryId(), "integer") . "," . // id
94 $ilDB->quote($this->getType(), "text") . // type
95 ")");
96 //table il_bibl_attribute
97 foreach ($this->getAttributes() as $attribute) {
98 //auto-increment il_bibl_attribute
99 $id = $ilDB->nextID('il_bibl_attribute');
100 $ilDB->manipulate("INSERT INTO il_bibl_attribute " . "(entry_id, name, value, id) VALUES (" . $ilDB->quote($this->getEntryId(), "integer")
101 . "," . // entry_id
102 $ilDB->quote($attribute['name'], "text") . "," . // name
103 $ilDB->quote($attribute['value'], "text") . "," . // value
104 $ilDB->quote($id, "integer") . // id
105 ")");
106 }
107 }
global $ilDB

References $ilDB, getAttributes(), and setEntryId().

+ Here is the call graph for this function:

◆ doDelete()

ilBibliographicEntry::doDelete ( )

Definition at line 136 of file class.ilBibliographicEntry.php.

136 {
137 global $ilDB;
138 $this->emptyCache();
139 $this->deleteOptions();
140 $ilDB->manipulate("DELETE FROM il_bibl_entry WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
141 $ilDB->manipulate("DELETE FROM il_bibl_attribute WHERE entry_id = " . $ilDB->quote($this->getEntryId(), "integer"));
142 }

References $ilDB.

◆ doRead()

ilBibliographicEntry::doRead ( )

Definition at line 110 of file class.ilBibliographicEntry.php.

110 {
111 global $ilDB;
112 //table il_bibl_entry
113 $set = $ilDB->query("SELECT * FROM il_bibl_entry " . " WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
114 while ($rec = $ilDB->fetchAssoc($set)) {
115 $this->setType($rec['type']);
116 }
117 $this->setAttributes($this->loadAttributes());
118 $this->initOverviewHTML();
119 }
loadAttributes()
Reads all the entrys attributes from database.

References $ilDB, initOverviewHTML(), loadAttributes(), setAttributes(), and setType().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilBibliographicEntry::doUpdate ( )

Definition at line 122 of file class.ilBibliographicEntry.php.

122 {
123 global $ilDB;
124 //table il_bibl_entry
125 $ilDB->manipulate($up = "UPDATE il_bibl_entry SET " . " type = " . $ilDB->quote($this->getType(), "integer") . // type
126 " WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
127 //table il_bibl_attribute
128 foreach ($this->getAttributes() as $attribute) {
129 $ilDB->manipulate($up = "UPDATE il_bibl_attribute SET " . " name = " . $ilDB->quote($attribute['name'], "integer") . "," . // name
130 " value = " . $ilDB->quote($attribute['value'], "integer") . "," . // value
131 " WHERE id = " . $ilDB->quote($attribute['id'], "integer"));
132 }
133 }

References $ilDB, and getAttributes().

+ Here is the call graph for this function:

◆ getAllEntries()

static ilBibliographicEntry::getAllEntries (   $object_id)
static

Read all entries from the database.

Parameters
$object_id
Returns
array

Definition at line 285 of file class.ilBibliographicEntry.php.

285 {
286 global $ilDB;
287 $entries = array();
288 $set = $ilDB->query("SELECT id FROM il_bibl_entry " . " WHERE data_id = " . $ilDB->quote($object_id, "integer"));
289 while ($rec = $ilDB->fetchAssoc($set)) {
290 $entries[]['entry_id'] = $rec['id'];
291 }
292
293 return $entries;
294 }

References $ilDB.

Referenced by ilDataBibliographicRecordListTableGUI\initData().

+ Here is the caller graph for this function:

◆ getAttributes()

ilBibliographicEntry::getAttributes ( )
Returns
string[]

Definition at line 187 of file class.ilBibliographicEntry.php.

References $attributes.

Referenced by doCreate(), doUpdate(), and ilBibliographicSetting\generateLibraryLink().

+ Here is the caller graph for this function:

◆ getBibliographicObjId()

ilBibliographicEntry::getBibliographicObjId ( )
Returns
int

Definition at line 225 of file class.ilBibliographicEntry.php.

References $bibliographic_obj_id.

◆ getEntryId()

ilBibliographicEntry::getEntryId ( )
Returns
int

Definition at line 241 of file class.ilBibliographicEntry.php.

241 {
242 return $this->entry_id;
243 }

References $entry_id.

◆ getFileType()

ilBibliographicEntry::getFileType ( )
Returns
string

Definition at line 265 of file class.ilBibliographicEntry.php.

265 {
266 return $this->file_type;
267 }

References $file_type.

◆ getInstance()

static ilBibliographicEntry::getInstance (   $file_type,
  $entry_id = NULL 
)
static
Parameters
$file_type
null$entry_id
Returns
ilBibliographicEntry

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

60 {
61 if (! $entry_id) {
62 return new self($file_type, $entry_id);
63 }
64
65 if (! isset(self::$instances[$entry_id])) {
66 self::$instances[$entry_id] = new self($file_type, $entry_id);
67 }
68
69 return self::$instances[$entry_id];
70 }

References $entry_id, and $file_type.

Referenced by ilDataBibliographicRecordListTableGUI\fillRow(), ilBibliographicDetailsGUI\getInstance(), ilDataBibliographicRecordListTableGUI\initData(), and ilObjBibliographic\writeSourcefileEntriesToDb().

+ Here is the caller graph for this function:

◆ getOverview()

ilBibliographicEntry::getOverview ( )
Returns
string

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

References $overview.

◆ getType()

ilBibliographicEntry::getType ( )
Returns
string

Definition at line 257 of file class.ilBibliographicEntry.php.

References $type.

Referenced by ilBibliographicSetting\generateLibraryLink(), and loadAttributes().

+ Here is the caller graph for this function:

◆ initOverviewHTML()

ilBibliographicEntry::initOverviewHTML ( )

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

192 {
193 $ilBiblOverviewGUI = new ilBiblOverviewGUI($this);
194 $this->setOverview($ilBiblOverviewGUI->getHtml());
195 }
Class ilBiblOverviewGUI.

References setOverview().

Referenced by doRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAttributes()

ilBibliographicEntry::loadAttributes ( )
protected

Reads all the entrys attributes from database.

Returns
array Attributes of an entry

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

150 {
151 global $ilDB;
152 $all_attributes = array();
153 //table il_bibl_attribute
154 $set = $ilDB->query("SELECT * FROM il_bibl_attribute " . " WHERE entry_id = " . $ilDB->quote($this->getEntryId(), "integer"));
155 while ($rec = $ilDB->fetchAssoc($set)) {
156 $all_attributes[$rec['name']] = $rec['value'];
157 }
158 if ($this->file_type == "ris") {
159 //for RIS-Files also add the type;
160 $type = $this->getType();
161 } else {
162 $type = 'default';
163 }
164 $parsed_attributes = array();
165 foreach ($all_attributes as $key => $value) {
166 // surround links with <a href="">
167 // Allowed signs in URL: a-z A-Z 0-9 . ? & _ / - ~ ! ' * ( ) + , : ; @ = $ # [ ] %
168 $value = preg_replace('!(http)(s)?:\/\/[a-zA-Z0-9.?&_/\-~\!\'\*()+,:;@=$#\[\]%]+!', "<a href=\"\\0\" target=\"_blank\" rel=\"noopener\">\\0</a>", $value);
169 $parsed_attributes[strtolower($this->file_type . '_' . $type . '_' . $key)] = $value;
170 }
171
172 return $parsed_attributes;
173 }

References $ilDB, $type, and getType().

Referenced by doRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAttributes()

ilBibliographicEntry::setAttributes (   $attributes)
Parameters
$attributes

Definition at line 179 of file class.ilBibliographicEntry.php.

179 {
180 $this->attributes = $attributes;
181 }

References $attributes.

Referenced by doRead().

+ Here is the caller graph for this function:

◆ setBibliographicObjId()

ilBibliographicEntry::setBibliographicObjId (   $bibliographic_obj_id)
Parameters
int$bibliographic_obj_id

Definition at line 217 of file class.ilBibliographicEntry.php.

217 {
218 $this->bibliographic_obj_id = $bibliographic_obj_id;
219 }

References $bibliographic_obj_id.

◆ setEntryId()

ilBibliographicEntry::setEntryId (   $entry_id)
Parameters
int$entry_id

Definition at line 233 of file class.ilBibliographicEntry.php.

233 {
234 $this->entry_id = $entry_id;
235 }

References $entry_id.

Referenced by __construct(), and doCreate().

+ Here is the caller graph for this function:

◆ setFileType()

ilBibliographicEntry::setFileType (   $file_type)
Parameters
string$file_type

Definition at line 273 of file class.ilBibliographicEntry.php.

273 {
274 $this->file_type = $file_type;
275 }

References $file_type.

◆ setOverview()

ilBibliographicEntry::setOverview (   $overview)
Parameters
string$overview

Definition at line 209 of file class.ilBibliographicEntry.php.

209 {
210 $this->overview = $overview;
211 }

References $overview.

Referenced by initOverviewHTML().

+ Here is the caller graph for this function:

◆ setType()

ilBibliographicEntry::setType (   $type)
Parameters
string$type

Definition at line 249 of file class.ilBibliographicEntry.php.

249 {
250 $this->type = $type;
251 }

References $type.

Referenced by doRead().

+ Here is the caller graph for this function:

Field Documentation

◆ $attributes

ilBibliographicEntry::$attributes
protected

Definition at line 37 of file class.ilBibliographicEntry.php.

Referenced by getAttributes(), and setAttributes().

◆ $bibliographic_obj_id

ilBibliographicEntry::$bibliographic_obj_id
protected

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

Referenced by getBibliographicObjId(), and setBibliographicObjId().

◆ $entry_id

ilBibliographicEntry::$entry_id
protected

Definition at line 25 of file class.ilBibliographicEntry.php.

Referenced by __construct(), getEntryId(), getInstance(), and setEntryId().

◆ $file_type

ilBibliographicEntry::$file_type
protected

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

Referenced by __construct(), getFileType(), getInstance(), and setFileType().

◆ $instances

ilBibliographicEntry::$instances = array()
staticprotected

Definition at line 51 of file class.ilBibliographicEntry.php.

◆ $overview

ilBibliographicEntry::$overview = ''
protected

Definition at line 47 of file class.ilBibliographicEntry.php.

Referenced by getOverview(), and setOverview().

◆ $type

ilBibliographicEntry::$type
protected

Definition at line 31 of file class.ilBibliographicEntry.php.

Referenced by getType(), loadAttributes(), and setType().


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