ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 27 of file class.ilMDIdentifier.php.

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

88  : array
89  {
90  return array(
91  'rbac_id' => array('integer', $this->getRBACId()),
92  'obj_id' => array('integer', $this->getObjId()),
93  'obj_type' => array('text', $this->getObjType()),
94  'parent_type' => array('text', $this->getParentType()),
95  'parent_id' => array('integer', $this->getParentId()),
96  'catalog' => array('text', $this->getCatalog()),
97  'entry' => array('text', $this->getEntry())
98  );
99  }
+ 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 173 of file class.ilMDIdentifier.php.

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

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

◆ _getEntriesForRbacObj()

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

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

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

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

◆ _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 150 of file class.ilMDIdentifier.php.

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

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

150  : array
151  {
152  global $DIC;
153 
154  $ilDB = $DIC->database();
155 
156  $query = "SELECT meta_identifier_id FROM il_meta_identifier " .
157  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
158  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
159  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
160  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
161 
162  $res = $ilDB->query($query);
163  $ids = [];
164  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
165  $ids[] = (int) $row->meta_identifier_id;
166  }
167  return $ids;
168  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDIdentifier::delete ( )

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

References $res, and ilMDBase\getMetaId().

74  : bool
75  {
76  if ($this->getMetaId()) {
77  $query = "DELETE FROM il_meta_identifier " .
78  "WHERE meta_identifier_id = " . $this->db->quote($this->getMetaId(), 'integer');
79  $res = $this->db->manipulate($query);
80  return true;
81  }
82  return false;
83  }
$res
Definition: ltiservices.php:66
+ 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 226 of file class.ilMDIdentifier.php.

References $DIC, $ilDB, and $r.

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

◆ getCatalog()

ilMDIdentifier::getCatalog ( )

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

References $catalog.

Referenced by __getFields(), and toXML().

38  : string
39  {
40  return $this->catalog;
41  }
+ Here is the caller graph for this function:

◆ getEntry()

ilMDIdentifier::getEntry ( )

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

References $entry.

Referenced by __getFields(), and toXML().

48  : string
49  {
50  return $this->entry;
51  }
+ Here is the caller graph for this function:

◆ read()

ilMDIdentifier::read ( )

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

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

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

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

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

◆ save()

ilMDIdentifier::save ( )

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

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

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

◆ setCatalog()

ilMDIdentifier::setCatalog ( string  $a_catalog)

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

Referenced by read().

33  : void
34  {
35  $this->catalog = $a_catalog;
36  }
+ Here is the caller graph for this function:

◆ setEntry()

ilMDIdentifier::setEntry ( string  $a_entry)

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

Referenced by read(), and ilMDXMLCopier\startParsing().

43  : void
44  {
45  $this->entry = $a_entry;
46  }
+ Here is the caller graph for this function:

◆ toXML()

ilMDIdentifier::toXML ( ilXmlWriter  $writer)

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

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

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

◆ update()

ilMDIdentifier::update ( )

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

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

65  : bool
66  {
67  return $this->getMetaId() && $this->db->update(
68  'il_meta_identifier',
69  $this->__getFields(),
70  array("meta_identifier_id" => array('integer', $this->getMetaId()))
71  );
72  }
+ Here is the call graph for this function:

Field Documentation

◆ $catalog

string ilMDIdentifier::$catalog = ''
private

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

Referenced by getCatalog().

◆ $entry

string ilMDIdentifier::$entry = ''
private

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

Referenced by getEntry().


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