ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 96 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 105 of file class.ilBibliographicEntry.php.

105 {
106 global $DIC;
107 $ilDB = $DIC['ilDB'];
108 //auto-increment il_bibl_entry
109 $this->setEntryId($ilDB->nextID('il_bibl_entry'));
110 //table il_bibl_entry
111 $ilDB->manipulate("INSERT INTO il_bibl_entry " . "(data_id, id, type) VALUES (" . $ilDB->quote($this->getBibliographicObjId(), "integer")
112 . "," . // data_id
113 $ilDB->quote($this->getEntryId(), "integer") . "," . // id
114 $ilDB->quote($this->getType(), "text") . // type
115 ")");
116 //table il_bibl_attribute
117 foreach ($this->getAttributes() as $attribute) {
118 //auto-increment il_bibl_attribute
119 $id = $ilDB->nextID('il_bibl_attribute');
120 $ilDB->manipulate("INSERT INTO il_bibl_attribute " . "(entry_id, name, value, id) VALUES (" . $ilDB->quote($this->getEntryId(), "integer")
121 . "," . // entry_id
122 $ilDB->quote($attribute['name'], "text") . "," . // name
123 $ilDB->quote($attribute['value'], "text") . "," . // value
124 $ilDB->quote($id, "integer") . // id
125 ")");
126 }
127 }
global $ilDB
global $DIC

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

+ Here is the call graph for this function:

◆ doDelete()

ilBibliographicEntry::doDelete ( )

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

158 {
159 global $DIC;
160 $ilDB = $DIC['ilDB'];
161 $this->emptyCache();
162 $this->deleteOptions();
163 $ilDB->manipulate("DELETE FROM il_bibl_entry WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
164 $ilDB->manipulate("DELETE FROM il_bibl_attribute WHERE entry_id = " . $ilDB->quote($this->getEntryId(), "integer"));
165 }

References $DIC, and $ilDB.

◆ doRead()

ilBibliographicEntry::doRead ( )

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

130 {
131 global $DIC;
132 $ilDB = $DIC['ilDB'];
133 //table il_bibl_entry
134 $set = $ilDB->query("SELECT * FROM il_bibl_entry " . " WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
135 while ($rec = $ilDB->fetchAssoc($set)) {
136 $this->setType($rec['type']);
137 }
138 $this->setAttributes($this->loadAttributes());
139 $this->initOverviewHTML();
140 }
loadAttributes()
Reads all the entrys attributes from database.

References $DIC, $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 143 of file class.ilBibliographicEntry.php.

143 {
144 global $DIC;
145 $ilDB = $DIC['ilDB'];
146 //table il_bibl_entry
147 $ilDB->manipulate($up = "UPDATE il_bibl_entry SET " . " type = " . $ilDB->quote($this->getType(), "integer") . // type
148 " WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
149 //table il_bibl_attribute
150 foreach ($this->getAttributes() as $attribute) {
151 $ilDB->manipulate($up = "UPDATE il_bibl_attribute SET " . " name = " . $ilDB->quote($attribute['name'], "integer") . "," . // name
152 " value = " . $ilDB->quote($attribute['value'], "integer") . "," . // value
153 " WHERE id = " . $ilDB->quote($attribute['id'], "integer"));
154 }
155 }

References $DIC, $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 309 of file class.ilBibliographicEntry.php.

309 {
310 global $DIC;
311 $ilDB = $DIC['ilDB'];
312 $entries = array();
313 $set = $ilDB->query("SELECT id FROM il_bibl_entry " . " WHERE data_id = " . $ilDB->quote($object_id, "integer"));
314 while ($rec = $ilDB->fetchAssoc($set)) {
315 $entries[]['entry_id'] = $rec['id'];
316 }
317
318 return $entries;
319 }

References $DIC, and $ilDB.

Referenced by ilDataBibliographicRecordListTableGUI\initData().

+ Here is the caller graph for this function:

◆ getAttributes()

ilBibliographicEntry::getAttributes ( )
Returns
string[]

Definition at line 211 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 249 of file class.ilBibliographicEntry.php.

References $bibliographic_obj_id.

◆ getEntryId()

ilBibliographicEntry::getEntryId ( )
Returns
int

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

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

References $entry_id.

◆ getFileType()

ilBibliographicEntry::getFileType ( )
Returns
string

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

289 {
290 return $this->file_type;
291 }

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 225 of file class.ilBibliographicEntry.php.

References $overview.

◆ getType()

ilBibliographicEntry::getType ( )
Returns
string

Definition at line 281 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 216 of file class.ilBibliographicEntry.php.

216 {
217 $ilBiblOverviewGUI = new ilBiblOverviewGUI($this);
218 $this->setOverview($ilBiblOverviewGUI->getHtml());
219 }
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 173 of file class.ilBibliographicEntry.php.

173 {
174 global $DIC;
175 $ilDB = $DIC['ilDB'];
176 $all_attributes = array();
177 //table il_bibl_attribute
178 $set = $ilDB->query("SELECT * FROM il_bibl_attribute " . " WHERE entry_id = " . $ilDB->quote($this->getEntryId(), "integer"));
179 while ($rec = $ilDB->fetchAssoc($set)) {
180 $all_attributes[$rec['name']] = $rec['value'];
181 }
182 if ($this->file_type == "ris") {
183 //for RIS-Files also add the type;
184 $type = $this->getType();
185 } else {
186 $type = 'default';
187 }
188 $parsed_attributes = array();
189 foreach ($all_attributes as $key => $value) {
190 // surround links with <a href="">
191 // Allowed signs in URL: a-z A-Z 0-9 . ? & _ / - ~ ! ' * ( ) + , : ; @ = $ # [ ] %
192 $value = preg_replace('!(http)(s)?:\/\/[a-zA-Z0-9.?&_/\-~\!\'\*()+,:;@=$#\[\]%]+!', "<a href=\"\\0\" target=\"_blank\" rel=\"noopener\">\\0</a>", $value);
193 $parsed_attributes[strtolower($this->file_type . '_' . $type . '_' . $key)] = $value;
194 }
195
196 return $parsed_attributes;
197 }

References $DIC, $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 203 of file class.ilBibliographicEntry.php.

203 {
204 $this->attributes = $attributes;
205 }

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 241 of file class.ilBibliographicEntry.php.

241 {
242 $this->bibliographic_obj_id = $bibliographic_obj_id;
243 }

References $bibliographic_obj_id.

◆ setEntryId()

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

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

257 {
258 $this->entry_id = $entry_id;
259 }

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 297 of file class.ilBibliographicEntry.php.

297 {
298 $this->file_type = $file_type;
299 }

References $file_type.

◆ setOverview()

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

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

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

References $overview.

Referenced by initOverviewHTML().

+ Here is the caller graph for this function:

◆ setType()

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

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

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

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: