ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMDIdentifier Class Reference
+ Inheritance diagram for ilMDIdentifier:
+ Collaboration diagram for ilMDIdentifier:

Public Member Functions

 setCatalog ($a_catalog)
 
 getCatalog ()
 
 setEntry ($a_entry)
 
 getEntry ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer, $a_overwrite_id=false)
 
 setCatalog ($a_catalog)
 
 getCatalog ()
 
 setEntry ($a_entry)
 
 getEntry ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
- Public Member Functions inherited from ilMDBase
 __construct ($a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ($a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
static _getEntriesForObj ($a_rbac_id, $a_obj_id, $a_obj_type)
 Get IDs for an object. More...
 
static _getEntriesForRbacObj ($a_rbac_id, $a_obj_type="")
 Get IDs for an rbac object. More...
 
static existsIdInRbacObject ($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
 Does id entry exist in rbac object? More...
 
static readIdData ($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
 Does id entry exist in rbac object? More...
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDIdentifier::__getFields ( )

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

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

Referenced by save().

101  {
102  return array('rbac_id' => array('integer',$this->getRBACId()),
103  'obj_id' => array('integer',$this->getObjId()),
104  'obj_type' => array('text',$this->getObjType()),
105  'parent_type' => array('text',$this->getParentType()),
106  'parent_id' => array('integer',$this->getParentId()),
107  'catalog' => array('text',$this->getCatalog()),
108  'entry' => array('text',$this->getEntry()));
109 
110  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDIdentifier::__getFields ( )

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

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

102  {
103  return array('rbac_id' => $this->getRBACId(),
104  'obj_id' => $this->getObjId(),
105  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
106  'parent_type' => $this->getParentType(),
107  'parent_id' => $this->getParentId(),
108  'catalog' => ilUtil::prepareDBString($this->getCatalog()),
109  'entry' => ilUtil::prepareDBString($this->getEntry()));
110 
111  }
Create styles array
The data for the language used.
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getEntriesForObj()

static ilMDIdentifier::_getEntriesForObj (   $a_rbac_id,
  $a_obj_id,
  $a_obj_type 
)
static

Get IDs for an object.

Parameters

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

References $ilDB, $query, $r, $res, and array.

Referenced by ilLMObject\getExportId(), and ilLMObject\saveExportId().

194  {
195  global $ilDB;
196 
197  $query = "SELECT meta_identifier_id, catalog, entry FROM il_meta_identifier ".
198  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
199  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
200  "AND obj_type = ".$ilDB->quote($a_obj_type ,'text');
201 
202  $res = $ilDB->query($query);
203  $entries = array();
204  while($r = $ilDB->fetchAssoc($res))
205  {
206  $entries[$r["meta_identifier_id"]] =
207  array("catalog" => $r["catalog"],
208  "entry" => $r["entry"]);
209  }
210  return $entries;
211  }
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getEntriesForRbacObj()

static ilMDIdentifier::_getEntriesForRbacObj (   $a_rbac_id,
  $a_obj_type = "" 
)
static

Get IDs for an rbac object.

Parameters

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

References $ilDB, $query, $r, $res, and array.

Referenced by ilLMObject\getDuplicateExportIDs().

220  {
221  global $ilDB;
222 
223  $query = "SELECT meta_identifier_id, catalog, entry, obj_id FROM il_meta_identifier ".
224  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer');
225 
226  if ($a_obj_type != "")
227  {
228  $query.=
229  " AND obj_type = ".$ilDB->quote($a_obj_type ,'text');
230  }
231 
232  $res = $ilDB->query($query);
233  $entries = array();
234  while($r = $ilDB->fetchAssoc($res))
235  {
236  $entries[$r["meta_identifier_id"]] =
237  array("catalog" => $r["catalog"],
238  "entry" => $r["entry"],
239  "obj_id" => $r["obj_id"]);
240  }
241  return $entries;
242  }
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getIds() [1/2]

ilMDIdentifier::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

151  {
152  global $ilDB;
153 
154  $query = "SELECT meta_identifier_id FROM il_meta_identifier ".
155  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
156  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
157  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
158  "AND parent_type = ".$ilDB->quote($a_parent_type);
159 
160 
161  $res = $ilDB->query($query);
162  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
163  {
164  $ids[] = $row->meta_identifier_id;
165  }
166  return $ids ? $ids : array();
167  }
Create styles array
The data for the language used.
global $ilDB

◆ _getIds() [2/2]

static ilMDIdentifier::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)
static

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

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

170  {
171  global $ilDB;
172 
173  $query = "SELECT meta_identifier_id FROM il_meta_identifier ".
174  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
175  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
176  "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
177  "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
178 
179  $res = $ilDB->query($query);
180  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
181  {
182  $ids[] = $row->meta_identifier_id;
183  }
184  return $ids ? $ids : array();
185  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDIdentifier::delete ( )

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

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

85  {
86  global $ilDB;
87 
88  if($this->getMetaId())
89  {
90  $query = "DELETE FROM il_meta_identifier ".
91  "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId());
92 
93  $this->db->query($query);
94 
95  return true;
96  }
97  return false;
98  }
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDIdentifier::delete ( )

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

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

86  {
87  global $ilDB;
88 
89  if($this->getMetaId())
90  {
91  $query = "DELETE FROM il_meta_identifier ".
92  "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId() ,'integer');
93  $res = $ilDB->manipulate($query);
94  return true;
95  }
96  return false;
97  }
global $ilDB
+ Here is the call graph for this function:

◆ existsIdInRbacObject()

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

Does id entry exist in rbac object?

Parameters

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

References $ilDB, $query, and $r.

Referenced by ilLMObject\existsExportID().

251  {
252  global $ilDB;
253 
254  $query = "SELECT meta_identifier_id, obj_id FROM il_meta_identifier ".
255  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id , 'integer').
256  " AND obj_type = ".$ilDB->quote($a_obj_type , 'text').
257  " AND catalog = ".$ilDB->quote($a_catalog , 'text').
258  " AND entry = ".$ilDB->quote($a_entry , 'text');
259  $s = $ilDB->query($query);
260  if ($r = $ilDB->fetchAssoc($s))
261  {
262  return true;
263  }
264  return false;
265  }
$r
Definition: example_031.php:79
global $ilDB
+ Here is the caller graph for this function:

◆ getCatalog() [1/2]

ilMDIdentifier::getCatalog ( )

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

41  {
42  return $this->catalog;
43  }

◆ getCatalog() [2/2]

ilMDIdentifier::getCatalog ( )

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

Referenced by __getFields(), and toXML().

41  {
42  return $this->catalog;
43  }
+ Here is the caller graph for this function:

◆ getEntry() [1/2]

ilMDIdentifier::getEntry ( )

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

Referenced by __getFields(), and toXML().

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

◆ getEntry() [2/2]

ilMDIdentifier::getEntry ( )

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

49  {
50  return $this->entry;
51  }

◆ read() [1/2]

ilMDIdentifier::read ( )

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

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

113  {
114  global $ilDB;
115 
116  if($this->getMetaId())
117  {
118  $query = "SELECT * FROM il_meta_identifier ".
119  "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId() ,'integer');
120 
121  $res = $this->db->query($query);
122  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
123  {
124  $this->setRBACId($row->rbac_id);
125  $this->setObjId($row->obj_id);
126  $this->setObjType($row->obj_type);
127  $this->setParentId($row->parent_id);
128  $this->setParentType($row->parent_type);
129  $this->setCatalog($row->catalog);
130  $this->setEntry($row->entry);
131  }
132  }
133  return true;
134  }
setObjType($a_type)
setObjId($a_id)
setRBACId($a_id)
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDIdentifier::read ( )

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

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

114  {
115  global $ilDB;
116 
117  if($this->getMetaId())
118  {
119  $query = "SELECT * FROM il_meta_identifier ".
120  "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId());
121 
122  $res = $this->db->query($query);
123  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
124  {
125  $this->setRBACId($row->rbac_id);
126  $this->setObjId($row->obj_id);
127  $this->setObjType($row->obj_type);
128  $this->setParentId($row->parent_id);
129  $this->setParentType($row->parent_type);
130  $this->setCatalog(ilUtil::stripSlashes($row->catalog));
131  $this->setEntry(ilUtil::stripSlashes($row->entry));
132  }
133  }
134  return true;
135  }
setObjType($a_type)
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ readIdData()

static ilMDIdentifier::readIdData (   $a_rbac_id,
  $a_obj_type,
  $a_catalog,
  $a_entry 
)
static

Does id entry exist in rbac object?

Parameters

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

References $data, $ilDB, $query, $r, and array.

Referenced by ilLMObject\getExportIDInfo().

274  {
275  global $ilDB;
276 
277  $query = "SELECT * FROM il_meta_identifier ".
278  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id , 'integer').
279  " AND obj_type = ".$ilDB->quote($a_obj_type , 'text').
280  " AND catalog = ".$ilDB->quote($a_catalog , 'text').
281  " AND entry = ".$ilDB->quote($a_entry , 'text');
282  $s = $ilDB->query($query);
283  $data = array();
284  while ($r = $ilDB->fetchAssoc($s))
285  {
286  $data[] = $r;
287  }
288  return $data;
289  }
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ save() [1/2]

ilMDIdentifier::save ( )

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

References ilMDBase\getMetaId(), ilDBConstants\MDB2_AUTOQUERY_INSERT, and ilMDBase\setMetaId().

55  {
56  if($this->db->autoExecute('il_meta_identifier',
57  $this->__getFields(),
59  {
60  $this->setMetaId($this->db->getLastInsertId());
61 
62  return $this->getMetaId();
63  }
64  return false;
65  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDIdentifier::save ( )

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

References $ilDB, __getFields(), array, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

55  {
56  global $ilDB;
57 
58  $fields = $this->__getFields();
59  $fields['meta_identifier_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_identifier'));
60 
61  if($this->db->insert('il_meta_identifier',$fields))
62  {
63  $this->setMetaId($next_id);
64  return $this->getMetaId();
65  }
66  return false;
67  }
setMetaId($a_meta_id, $a_read_data=true)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ setCatalog() [1/2]

ilMDIdentifier::setCatalog (   $a_catalog)

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

37  {
38  $this->catalog = $a_catalog;
39  }

◆ setCatalog() [2/2]

ilMDIdentifier::setCatalog (   $a_catalog)

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

Referenced by read().

37  {
38  $this->catalog = $a_catalog;
39  }
+ Here is the caller graph for this function:

◆ setEntry() [1/2]

ilMDIdentifier::setEntry (   $a_entry)

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

45  {
46  $this->entry = $a_entry;
47  }

◆ setEntry() [2/2]

ilMDIdentifier::setEntry (   $a_entry)

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

Referenced by read().

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

◆ toXML() [1/2]

ilMDIdentifier::toXML ( $writer,
  $a_overwrite_id = false 
)

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

References array, getCatalog(), getEntry(), ilMDBase\getExportMode(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

142  {
143  $entry_default = ($this->getObjId() == 0)
144  ? "il_".IL_INST_ID."_".$this->getObjType()."_".$this->getRBACId()
145  : "il_".IL_INST_ID."_".$this->getObjType()."_".$this->getObjId();
146 
147  $entry = $this->getEntry() ? $this->getEntry() : $entry_default;
148  $catalog = $this->getCatalog();
149 
150  if ($this->getExportMode() && $this->getCatalog() != "ILIAS_NID")
151  {
152  $entry = $entry_default;
153  $catalog = "ILIAS";
154  }
155 
156  if(strlen($catalog))
157  {
158  $writer->xmlElement('Identifier',array('Catalog' => $catalog,
159  'Entry' => $entry));
160  }
161  else
162  {
163  $writer->xmlElement('Identifier',array('Entry' => $entry));
164  }
165  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDIdentifier::toXML ( $writer)

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

References array, getCatalog(), and getEntry().

143  {
144  $writer->xmlElement('Identifier',array('Catalog' => $this->getCatalog(),
145  'Entry' => $this->getEntry()));
146  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDIdentifier::update ( )

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

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

68  {
69  global $ilDB;
70 
71  if($this->getMetaId())
72  {
73  if($this->db->autoExecute('il_meta_identifier',
74  $this->__getFields(),
76  "meta_identifier_id = ".$ilDB->quote($this->getMetaId())))
77  {
78  return true;
79  }
80  }
81  return false;
82  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDIdentifier::update ( )

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

References $ilDB, array, and ilMDBase\getMetaId().

70  {
71  global $ilDB;
72 
73  if($this->getMetaId())
74  {
75  if($this->db->update('il_meta_identifier',
76  $this->__getFields(),
77  array("meta_identifier_id" => array('integer',$this->getMetaId()))))
78  {
79  return true;
80  }
81  }
82  return false;
83  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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