66 if (!isset(self::$instances[
$entry_id])) {
80 public static function exists(
$entry_id, $obj_id)
82 $q =
"SELECT * FROM il_bibl_entry WHERE id = %s AND data_id = %s";
88 $r =
$ilDB->queryF($q, array(
'integer',
'integer'), array(
$entry_id, $obj_id));
90 return (
$r->numRows() > 0);
115 $ilDB->manipulate(
"INSERT INTO il_bibl_entry " .
"(data_id, id, type) VALUES ("
116 .
$ilDB->quote($this->getBibliographicObjId(),
"integer") .
","
118 $ilDB->quote($this->getEntryId(),
"integer") .
"," .
119 $ilDB->quote($this->getType(),
"text") .
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") .
"," .
128 $ilDB->quote($attribute[
'name'],
"text") .
"," .
129 $ilDB->quote($attribute[
'value'],
"text") .
"," .
141 $set =
$ilDB->query(
"SELECT * FROM il_bibl_entry " .
" WHERE id = "
142 .
$ilDB->quote($this->getEntryId(),
"integer"));
143 while ($rec =
$ilDB->fetchAssoc($set)) {
156 $ilDB->manipulate($up =
"UPDATE il_bibl_entry SET " .
" type = "
157 .
$ilDB->quote($this->getType(),
"integer") .
158 " WHERE id = " .
$ilDB->quote($this->getEntryId(),
"integer"));
161 $ilDB->manipulate($up =
"UPDATE il_bibl_attribute SET " .
" name = "
162 .
$ilDB->quote($attribute[
'name'],
"integer") .
"," .
163 " value = " .
$ilDB->quote($attribute[
'value'],
"integer") .
","
165 " WHERE id = " .
$ilDB->quote($attribute[
'id'],
"integer"));
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"));
192 $all_attributes = array();
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'];
199 if ($this->file_type ==
"ris") {
205 $parsed_attributes = array();
206 foreach ($all_attributes as
$key => $value) {
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;
213 return $parsed_attributes;
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'];
An exception for terminatinating execution or to throw for unit testing.
Class ilBibliographicEntry.
static getAllEntries($object_id)
Read all entries from the database.
__construct($file_type, $entry_id=null)
setAttributes($attributes)
loadAttributes()
Reads all the entrys attributes from database.
setBibliographicObjId($bibliographic_obj_id)
static getInstance($file_type, $entry_id=null)
if(!array_key_exists('StateId', $_REQUEST)) $id