ILIAS  release_8 Revision v8.24
ilMDIdentifier Class Reference
+ Inheritance diagram for ilMDIdentifier:
+ Collaboration diagram for ilMDIdentifier:

Public Member Functions

 setCatalog (string $a_catalog)
 
 getCatalog ()
 
 setEntry (string $a_entry)
 
 getEntry ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

static _getIds (int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
 
static _getEntriesForObj (int $a_rbac_id, int $a_obj_id, string $a_obj_type)
 
static _getEntriesForRbacObj (int $a_rbac_id, string $a_obj_type="")
 
static existsIdInRbacObject (int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
 
static readIdData (int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
 

Private Attributes

string $catalog = ''
 
string $entry = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

Definition at line 26 of file class.ilMDIdentifier.php.

Member Function Documentation

◆ __getFields()

ilMDIdentifier::__getFields ( )
Returns
array<string, array<string, mixed>>

Definition at line 87 of file class.ilMDIdentifier.php.

87 : array
88 {
89 return array(
90 'rbac_id' => array('integer', $this->getRBACId()),
91 'obj_id' => array('integer', $this->getObjId()),
92 'obj_type' => array('text', $this->getObjType()),
93 'parent_type' => array('text', $this->getParentType()),
94 'parent_id' => array('integer', $this->getParentId()),
95 'catalog' => array('text', $this->getCatalog()),
96 'entry' => array('text', $this->getEntry())
97 );
98 }

References getCatalog(), getEntry(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

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

◆ _getEntriesForObj()

static ilMDIdentifier::_getEntriesForObj ( int  $a_rbac_id,
int  $a_obj_id,
string  $a_obj_type 
)
static
Returns
array<int, array<string, string>>

Definition at line 172 of file class.ilMDIdentifier.php.

172 : array
173 {
174 global $DIC;
175
176 $ilDB = $DIC->database();
177
178 $query = "SELECT meta_identifier_id, catalog, entry FROM il_meta_identifier " .
179 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
180 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
181 "AND obj_type = " . $ilDB->quote($a_obj_type, 'text');
182
183 $res = $ilDB->query($query);
184 $entries = array();
185 while ($r = $ilDB->fetchAssoc($res)) {
186 $entries[$r["meta_identifier_id"]] =
187 array(
188 "catalog" => $r["catalog"],
189 "entry" => $r["entry"]
190 );
191 }
192 return $entries;
193 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, and $res.

◆ _getEntriesForRbacObj()

static ilMDIdentifier::_getEntriesForRbacObj ( int  $a_rbac_id,
string  $a_obj_type = "" 
)
static
Returns
array<int, array<string, mixed>>

Definition at line 198 of file class.ilMDIdentifier.php.

198 : array
199 {
200 global $DIC;
201
202 $ilDB = $DIC->database();
203
204 $query = "SELECT meta_identifier_id, catalog, entry, obj_id FROM il_meta_identifier " .
205 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer');
206
207 if ($a_obj_type !== "") {
208 $query .=
209 " AND obj_type = " . $ilDB->quote($a_obj_type, 'text');
210 }
211
212 $res = $ilDB->query($query);
213 $entries = array();
214 while ($r = $ilDB->fetchAssoc($res)) {
215 $entries[$r["meta_identifier_id"]] =
216 array(
217 "catalog" => $r["catalog"],
218 "entry" => $r["entry"],
219 "obj_id" => $r["obj_id"]
220 );
221 }
222 return $entries;
223 }

References $DIC, $ilDB, $query, and $res.

◆ _getIds()

static ilMDIdentifier::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

Definition at line 149 of file class.ilMDIdentifier.php.

149 : array
150 {
151 global $DIC;
152
153 $ilDB = $DIC->database();
154
155 $query = "SELECT meta_identifier_id FROM il_meta_identifier " .
156 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
157 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
158 "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
159 "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
160
161 $res = $ilDB->query($query);
162 $ids = [];
163 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
164 $ids[] = (int) $row->meta_identifier_id;
165 }
166 return $ids;
167 }

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilMDGeneral\getIdentifierIds(), and ilMDMetaMetadata\getIdentifierIds().

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

◆ delete()

ilMDIdentifier::delete ( )

Reimplemented from ilMDBase.

Definition at line 73 of file class.ilMDIdentifier.php.

73 : bool
74 {
75 if ($this->getMetaId()) {
76 $query = "DELETE FROM il_meta_identifier " .
77 "WHERE meta_identifier_id = " . $this->db->quote($this->getMetaId(), 'integer');
78 $res = $this->db->manipulate($query);
79 return true;
80 }
81 return false;
82 }

References $query, $res, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ existsIdInRbacObject()

static ilMDIdentifier::existsIdInRbacObject ( int  $a_rbac_id,
string  $a_obj_type,
string  $a_catalog,
string  $a_entry 
)
static

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

230 : bool {
231 global $DIC;
232
233 $ilDB = $DIC->database();
234
235 $query = "SELECT meta_identifier_id, obj_id FROM il_meta_identifier " .
236 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') .
237 " AND obj_type = " . $ilDB->quote($a_obj_type, 'text') .
238 " AND catalog = " . $ilDB->quote($a_catalog, 'text') .
239 " AND entry = " . $ilDB->quote($a_entry, 'text');
240 $s = $ilDB->query($query);
241 if ($r = $ilDB->fetchAssoc($s)) {
242 return true;
243 }
244 return false;
245 }

◆ getCatalog()

ilMDIdentifier::getCatalog ( )

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

37 : string
38 {
39 return $this->catalog;
40 }

References $catalog.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getEntry()

ilMDIdentifier::getEntry ( )

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

47 : string
48 {
49 return $this->entry;
50 }

References $entry.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDIdentifier::read ( )

Reimplemented from ilMDBase.

Definition at line 100 of file class.ilMDIdentifier.php.

100 : bool
101 {
102 if ($this->getMetaId()) {
103 $query = "SELECT * FROM il_meta_identifier " .
104 "WHERE meta_identifier_id = " . $this->db->quote($this->getMetaId(), 'integer');
105
106 $res = $this->db->query($query);
107 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
108 $this->setRBACId((int) $row->rbac_id);
109 $this->setObjId((int) $row->obj_id);
110 $this->setObjType($row->obj_type);
111 $this->setParentId((int) $row->parent_id);
112 $this->setParentType($row->parent_type);
113 $this->setCatalog($row->catalog ?? '');
114 $this->setEntry($row->entry ?? '');
115 }
116 }
117 return true;
118 }
setObjType(string $a_type)
setParentType(string $a_parent_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setParentId(int $a_id)
setCatalog(string $a_catalog)
setEntry(string $a_entry)

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setCatalog(), setEntry(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ readIdData()

static ilMDIdentifier::readIdData ( int  $a_rbac_id,
string  $a_obj_type,
string  $a_catalog,
string  $a_entry 
)
static
Returns
array<int, array<string, mixed>>

Definition at line 250 of file class.ilMDIdentifier.php.

250 : array
251 {
252 global $DIC;
253
254 $ilDB = $DIC->database();
255
256 $query = "SELECT * FROM il_meta_identifier " .
257 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') .
258 " AND obj_type = " . $ilDB->quote($a_obj_type, 'text') .
259 " AND catalog = " . $ilDB->quote($a_catalog, 'text') .
260 " AND entry = " . $ilDB->quote($a_entry, 'text');
261 $s = $ilDB->query($query);
262 $data = array();
263 while ($r = $ilDB->fetchAssoc($s)) {
264 $data[] = $r;
265 }
266 return $data;
267 }

References $data, $DIC, $ilDB, and $query.

◆ save()

ilMDIdentifier::save ( )

Reimplemented from ilMDBase.

Definition at line 52 of file class.ilMDIdentifier.php.

52 : int
53 {
54 $fields = $this->__getFields();
55 $fields['meta_identifier_id'] = array('integer', $next_id = $this->db->nextId('il_meta_identifier'));
56
57 if ($this->db->insert('il_meta_identifier', $fields)) {
58 $this->setMetaId($next_id);
59 return $this->getMetaId();
60 }
61 return 0;
62 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

References __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ setCatalog()

ilMDIdentifier::setCatalog ( string  $a_catalog)

Definition at line 32 of file class.ilMDIdentifier.php.

32 : void
33 {
34 $this->catalog = $a_catalog;
35 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEntry()

ilMDIdentifier::setEntry ( string  $a_entry)

Definition at line 42 of file class.ilMDIdentifier.php.

42 : void
43 {
44 $this->entry = $a_entry;
45 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDIdentifier::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

Definition at line 120 of file class.ilMDIdentifier.php.

120 : void
121 {
122 $entry_default = ($this->getObjId() === 0)
123 ? "il_" . IL_INST_ID . "_" . $this->getObjType() . "_" . $this->getRBACId()
124 : "il_" . IL_INST_ID . "_" . $this->getObjType() . "_" . $this->getObjId();
125
126 $entry = $this->getEntry() ?: $entry_default;
127 $catalog = $this->getCatalog();
128
129 if ($this->getExportMode() && $this->getCatalog() !== "ILIAS_NID") {
130 $entry = $entry_default;
131 $catalog = "ILIAS";
132 }
133
134 if ($catalog !== '') {
135 $writer->xmlElement('Identifier', array(
136 'Catalog' => $catalog,
137 'Entry' => $entry
138 ));
139 } else {
140 $writer->xmlElement('Identifier', array('Entry' => $entry));
141 }
142 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
const IL_INST_ID
Definition: constants.php:40

References $catalog, $entry, getCatalog(), getEntry(), ilMDBase\getExportMode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), IL_INST_ID, and ilXmlWriter\xmlElement().

+ Here is the call graph for this function:

◆ update()

ilMDIdentifier::update ( )

Reimplemented from ilMDBase.

Definition at line 64 of file class.ilMDIdentifier.php.

64 : bool
65 {
66 return $this->getMetaId() && $this->db->update(
67 'il_meta_identifier',
68 $this->__getFields(),
69 array("meta_identifier_id" => array('integer', $this->getMetaId()))
70 );
71 }

References __getFields(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

Field Documentation

◆ $catalog

string ilMDIdentifier::$catalog = ''
private

Definition at line 28 of file class.ilMDIdentifier.php.

Referenced by getCatalog(), and toXML().

◆ $entry

string ilMDIdentifier::$entry = ''
private

Definition at line 29 of file class.ilMDIdentifier.php.

Referenced by getEntry(), and toXML().


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