ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 11 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 98 of file class.ilBibliographicEntry.php.

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

99  {
100  $this->file_type = $file_type;
101  if ($entry_id) {
102  $this->setEntryId($entry_id);
103  $this->doRead();
104  }
105  }
+ Here is the call graph for this function:

Member Function Documentation

◆ doCreate()

ilBibliographicEntry::doCreate ( )

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

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

109  {
110  global $DIC;
111  $ilDB = $DIC['ilDB'];
112  //auto-increment il_bibl_entry
113  $this->setEntryId($ilDB->nextID('il_bibl_entry'));
114  //table il_bibl_entry
115  $ilDB->manipulate("INSERT INTO il_bibl_entry " . "(data_id, id, type) VALUES ("
116  . $ilDB->quote($this->getBibliographicObjId(), "integer") . ","
117  . // data_id
118  $ilDB->quote($this->getEntryId(), "integer") . "," . // id
119  $ilDB->quote($this->getType(), "text") . // type
120  ")");
121  //table il_bibl_attribute
122  foreach ($this->getAttributes() as $attribute) {
123  //auto-increment il_bibl_attribute
124  $id = $ilDB->nextID('il_bibl_attribute');
125  $ilDB->manipulate("INSERT INTO il_bibl_attribute "
126  . "(entry_id, name, value, id) VALUES ("
127  . $ilDB->quote($this->getEntryId(), "integer") . "," . // entry_id
128  $ilDB->quote($attribute['name'], "text") . "," . // name
129  $ilDB->quote($attribute['value'], "text") . "," . // value
130  $ilDB->quote($id, "integer") . // id
131  ")");
132  }
133  }
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilDB
+ Here is the call graph for this function:

◆ doDelete()

ilBibliographicEntry::doDelete ( )

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

References $DIC, and $ilDB.

171  {
172  global $DIC;
173  $ilDB = $DIC['ilDB'];
174  $this->emptyCache();
175  $this->deleteOptions();
176  $ilDB->manipulate("DELETE FROM il_bibl_entry WHERE id = "
177  . $ilDB->quote($this->getEntryId(), "integer"));
178  $ilDB->manipulate("DELETE FROM il_bibl_attribute WHERE entry_id = "
179  . $ilDB->quote($this->getEntryId(), "integer"));
180  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ doRead()

ilBibliographicEntry::doRead ( )

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

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

Referenced by __construct().

137  {
138  global $DIC;
139  $ilDB = $DIC['ilDB'];
140  //table il_bibl_entry
141  $set = $ilDB->query("SELECT * FROM il_bibl_entry " . " WHERE id = "
142  . $ilDB->quote($this->getEntryId(), "integer"));
143  while ($rec = $ilDB->fetchAssoc($set)) {
144  $this->setType($rec['type']);
145  }
146  $this->setAttributes($this->loadAttributes());
147  $this->initOverviewHTML();
148  }
global $DIC
Definition: saml.php:7
loadAttributes()
Reads all the entrys attributes from database.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilBibliographicEntry::doUpdate ( )

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

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

152  {
153  global $DIC;
154  $ilDB = $DIC['ilDB'];
155  //table il_bibl_entry
156  $ilDB->manipulate($up = "UPDATE il_bibl_entry SET " . " type = "
157  . $ilDB->quote($this->getType(), "integer") . // type
158  " WHERE id = " . $ilDB->quote($this->getEntryId(), "integer"));
159  //table il_bibl_attribute
160  foreach ($this->getAttributes() as $attribute) {
161  $ilDB->manipulate($up = "UPDATE il_bibl_attribute SET " . " name = "
162  . $ilDB->quote($attribute['name'], "integer") . "," . // name
163  " value = " . $ilDB->quote($attribute['value'], "integer") . ","
164  . // value
165  " WHERE id = " . $ilDB->quote($attribute['id'], "integer"));
166  }
167  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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 339 of file class.ilBibliographicEntry.php.

References $DIC, $ilDB, and array.

Referenced by ilBibliographicRecordListTableGUI\initData().

340  {
341  global $DIC;
342  $ilDB = $DIC['ilDB'];
343  $entries = array();
344  $set = $ilDB->query("SELECT id FROM il_bibl_entry " . " WHERE data_id = "
345  . $ilDB->quote($object_id, "integer"));
346  while ($rec = $ilDB->fetchAssoc($set)) {
347  $entries[]['entry_id'] = $rec['id'];
348  }
349 
350  return $entries;
351  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getAttributes()

ilBibliographicEntry::getAttributes ( )
Returns
string[]

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

References $attributes.

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

230  {
231  return $this->attributes;
232  }
+ Here is the caller graph for this function:

◆ getBibliographicObjId()

ilBibliographicEntry::getBibliographicObjId ( )
Returns
int

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

References $bibliographic_obj_id.

◆ getEntryId()

ilBibliographicEntry::getEntryId ( )
Returns
int

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

References $entry_id.

291  {
292  return $this->entry_id;
293  }

◆ getFileType()

ilBibliographicEntry::getFileType ( )
Returns
string

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

References $file_type.

318  {
319  return $this->file_type;
320  }

◆ 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.

References $DIC, $entry_id, $file_type, $ilDB, $r, and array.

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

61  {
62  if (!$entry_id) {
63  return new self($file_type, $entry_id);
64  }
65 
66  if (!isset(self::$instances[$entry_id])) {
67  self::$instances[$entry_id] = new self($file_type, $entry_id);
68  }
69 
70  return self::$instances[$entry_id];
71  }
+ Here is the caller graph for this function:

◆ getOverview()

ilBibliographicEntry::getOverview ( )
Returns
string

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

References $overview.

246  {
247  return $this->overview;
248  }

◆ getType()

ilBibliographicEntry::getType ( )
Returns
string

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

References $type.

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

309  {
310  return $this->type;
311  }
+ Here is the caller graph for this function:

◆ initOverviewHTML()

ilBibliographicEntry::initOverviewHTML ( )

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

References setOverview().

Referenced by doRead().

236  {
237  $ilBiblOverviewGUI = new ilBiblOverviewGUI($this);
238  $this->setOverview($ilBiblOverviewGUI->getHtml());
239  }
Class ilBiblOverviewGUI.
+ 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 188 of file class.ilBibliographicEntry.php.

References $DIC, $ilDB, $key, $type, array, and getType().

Referenced by doRead().

189  {
190  global $DIC;
191  $ilDB = $DIC['ilDB'];
192  $all_attributes = array();
193  //table il_bibl_attribute
194  $set = $ilDB->query("SELECT * FROM il_bibl_attribute " . " WHERE entry_id = "
195  . $ilDB->quote($this->getEntryId(), "integer"));
196  while ($rec = $ilDB->fetchAssoc($set)) {
197  $all_attributes[$rec['name']] = $rec['value'];
198  }
199  if ($this->file_type == "ris") {
200  //for RIS-Files also add the type;
201  $type = $this->getType();
202  } else {
203  $type = 'default';
204  }
205  $parsed_attributes = array();
206  foreach ($all_attributes as $key => $value) {
207  // surround links with <a href="">
208  // Allowed signs in URL: a-z A-Z 0-9 . ? & _ / - ~ ! ' * ( ) + , : ; @ = $ # [ ] %
209  $value = preg_replace('!(http)(s)?:\/\/[a-zA-Z0-9.?&_/\-~\!\'\*()+,:;@=$#\[\]%]+!', "<a href=\"\\0\" target=\"_blank\" rel=\"noopener\">\\0</a>", $value);
210  $parsed_attributes[strtolower($this->file_type . '_' . $type . '_' . $key)] = $value;
211  }
212 
213  return $parsed_attributes;
214  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
$key
Definition: croninfo.php:18
+ 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 220 of file class.ilBibliographicEntry.php.

References $attributes.

Referenced by doRead().

221  {
222  $this->attributes = $attributes;
223  }
+ Here is the caller graph for this function:

◆ setBibliographicObjId()

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

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

References $bibliographic_obj_id.

264  {
265  $this->bibliographic_obj_id = $bibliographic_obj_id;
266  }

◆ setEntryId()

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

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

References $entry_id.

Referenced by __construct(), and doCreate().

282  {
283  $this->entry_id = $entry_id;
284  }
+ Here is the caller graph for this function:

◆ setFileType()

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

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

References $file_type.

327  {
328  $this->file_type = $file_type;
329  }

◆ setOverview()

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

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

References $overview.

Referenced by initOverviewHTML().

255  {
256  $this->overview = $overview;
257  }
+ Here is the caller graph for this function:

◆ setType()

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

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

References $type.

Referenced by doRead().

300  {
301  $this->type = $type;
302  }
+ 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: