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

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

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
+ Here is the call graph for this function:

◆ doDelete()

ilBibliographicEntry::doDelete ( )

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

References $DIC, and $ilDB.

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  }
global $ilDB
global $DIC

◆ doRead()

ilBibliographicEntry::doRead ( )

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

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

Referenced by __construct().

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.
global $ilDB
global $DIC
+ 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.

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

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  }
global $ilDB
global $DIC
+ 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.

References $DIC, $ilDB, and array.

Referenced by ilDataBibliographicRecordListTableGUI\initData().

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  }
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ 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().

211  {
212  return $this->attributes;
213  }
+ 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.

References $entry_id.

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

◆ getFileType()

ilBibliographicEntry::getFileType ( )
Returns
string

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

References $file_type.

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

◆ 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 ilDataBibliographicRecordListTableGUI\fillRow(), ilBibliographicDetailsGUI\getInstance(), ilDataBibliographicRecordListTableGUI\initData(), and ilObjBibliographic\writeSourcefileEntriesToDb().

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  }
+ Here is the caller graph for this function:

◆ getOverview()

ilBibliographicEntry::getOverview ( )
Returns
string

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

References $overview.

225  {
226  return $this->overview;
227  }

◆ getType()

ilBibliographicEntry::getType ( )
Returns
string

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

References $type.

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

281  {
282  return $this->type;
283  }
+ Here is the caller graph for this function:

◆ initOverviewHTML()

ilBibliographicEntry::initOverviewHTML ( )

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

References setOverview().

Referenced by doRead().

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

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

Referenced by doRead().

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  }
Create styles array
The data for the language used.
global $ilDB
global $DIC
+ 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.

References $attributes.

Referenced by doRead().

203  {
204  $this->attributes = $attributes;
205  }
+ 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.

References $bibliographic_obj_id.

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

◆ setEntryId()

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

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

References $entry_id.

Referenced by __construct(), and doCreate().

257  {
258  $this->entry_id = $entry_id;
259  }
+ 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.

References $file_type.

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

◆ setOverview()

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

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

References $overview.

Referenced by initOverviewHTML().

233  {
234  $this->overview = $overview;
235  }
+ Here is the caller graph for this function:

◆ setType()

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

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

References $type.

Referenced by doRead().

273  {
274  $this->type = $type;
275  }
+ 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: