ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMDIdentifier Class Reference
+ Inheritance diagram for ilMDIdentifier:
+ Collaboration diagram for ilMDIdentifier:

Public Member Functions

 ilMDIdentifier ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setCatalog ($a_catalog)
 
 getCatalog ()
 
 setEntry ($a_entry)
 
 getEntry ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer, $a_overwrite_id=false)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDIdentifier ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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
 ilMDBase ($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)
 
 ilMDBase ($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 _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
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDIdentifier::__getFields ( )

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

108 {
109 return array('rbac_id' => array('integer',$this->getRBACId()),
110 'obj_id' => array('integer',$this->getObjId()),
111 'obj_type' => array('text',$this->getObjType()),
112 'parent_type' => array('text',$this->getParentType()),
113 'parent_id' => array('integer',$this->getParentId()),
114 'catalog' => array('text',$this->getCatalog()),
115 'entry' => array('text',$this->getEntry()));
116
117 }

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

Referenced by save().

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

◆ __getFields() [2/2]

ilMDIdentifier::__getFields ( )

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

110 {
111 return array('rbac_id' => $this->getRBACId(),
112 'obj_id' => $this->getObjId(),
113 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
114 'parent_type' => $this->getParentType(),
115 'parent_id' => $this->getParentId(),
116 'catalog' => ilUtil::prepareDBString($this->getCatalog()),
117 'entry' => ilUtil::prepareDBString($this->getEntry()));
118
119 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ 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

return

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

201 {
202 global $ilDB;
203
204 $query = "SELECT meta_identifier_id, catalog, entry FROM il_meta_identifier ".
205 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
206 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
207 "AND obj_type = ".$ilDB->quote($a_obj_type ,'text');
208
209 $res = $ilDB->query($query);
210 $entries = array();
211 while($r = $ilDB->fetchAssoc($res))
212 {
213 $entries[$r["meta_identifier_id"]] =
214 array("catalog" => $r["catalog"],
215 "entry" => $r["entry"]);
216 }
217 return $entries;
218 }
$r
Definition: example_031.php:79
global $ilDB

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

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

+ 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

return

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

227 {
228 global $ilDB;
229
230 $query = "SELECT meta_identifier_id, catalog, entry, obj_id FROM il_meta_identifier ".
231 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer');
232
233 if ($a_obj_type != "")
234 {
235 $query.=
236 " AND obj_type = ".$ilDB->quote($a_obj_type ,'text');
237 }
238
239 $res = $ilDB->query($query);
240 $entries = array();
241 while($r = $ilDB->fetchAssoc($res))
242 {
243 $entries[$r["meta_identifier_id"]] =
244 array("catalog" => $r["catalog"],
245 "entry" => $r["entry"],
246 "obj_id" => $r["obj_id"]);
247 }
248 return $entries;
249 }

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

Referenced by ilLMObject\getDuplicateExportIDs().

+ 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 176 of file class.ilMDIdentifier.php.

177 {
178 global $ilDB;
179
180 $query = "SELECT meta_identifier_id FROM il_meta_identifier ".
181 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
182 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
183 "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
184 "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
185
186 $res = $ilDB->query($query);
187 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
188 {
189 $ids[] = $row->meta_identifier_id;
190 }
191 return $ids ? $ids : array();
192 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

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

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

159 {
160 global $ilDB;
161
162 $query = "SELECT meta_identifier_id FROM il_meta_identifier ".
163 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
164 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
165 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
166 "AND parent_type = ".$ilDB->quote($a_parent_type);
167
168
169 $res = $ilDB->query($query);
170 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
171 {
172 $ids[] = $row->meta_identifier_id;
173 }
174 return $ids ? $ids : array();
175 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

◆ delete() [1/2]

ilMDIdentifier::delete ( )

Reimplemented from ilMDBase.

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

93 {
94 global $ilDB;
95
96 if($this->getMetaId())
97 {
98 $query = "DELETE FROM il_meta_identifier ".
99 "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId() ,'integer');
100 $res = $ilDB->manipulate($query);
101 return true;
102 }
103 return false;
104 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDIdentifier::delete ( )

Reimplemented from ilMDBase.

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

93 {
94 global $ilDB;
95
96 if($this->getMetaId())
97 {
98 $query = "DELETE FROM il_meta_identifier ".
99 "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId());
100
101 $this->db->query($query);
102
103 return true;
104 }
105 return false;
106 }

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

+ 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

return

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

258 {
259 global $ilDB;
260
261 $query = "SELECT meta_identifier_id, obj_id FROM il_meta_identifier ".
262 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id , 'integer').
263 " AND obj_type = ".$ilDB->quote($a_obj_type , 'text').
264 " AND catalog = ".$ilDB->quote($a_catalog , 'text').
265 " AND entry = ".$ilDB->quote($a_entry , 'text');
266 $s = $ilDB->query($query);
267 if ($r = $ilDB->fetchAssoc($s))
268 {
269 return true;
270 }
271 return false;
272 }

References $ilDB, $query, and $r.

Referenced by ilLMObject\existsExportID().

+ Here is the caller graph for this function:

◆ getCatalog() [1/2]

ilMDIdentifier::getCatalog ( )

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

48 {
49 return $this->catalog;
50 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCatalog() [2/2]

ilMDIdentifier::getCatalog ( )

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

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

◆ getEntry() [1/2]

ilMDIdentifier::getEntry ( )

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

56 {
57 return $this->entry;
58 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getEntry() [2/2]

ilMDIdentifier::getEntry ( )

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

57 {
58 return $this->entry;
59 }

◆ ilMDIdentifier() [1/2]

ilMDIdentifier::ilMDIdentifier (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

36 {
37 parent::ilMDBase($a_rbac_id,
38 $a_obj_id,
39 $a_obj_type);
40 }

◆ ilMDIdentifier() [2/2]

ilMDIdentifier::ilMDIdentifier (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37 {
38 parent::ilMDBase($a_rbac_id,
39 $a_obj_id,
40 $a_obj_type);
41 }

◆ read() [1/2]

ilMDIdentifier::read ( )

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

120 {
121 global $ilDB;
122
123 if($this->getMetaId())
124 {
125 $query = "SELECT * FROM il_meta_identifier ".
126 "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId() ,'integer');
127
128 $res = $this->db->query($query);
129 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
130 {
131 $this->setRBACId($row->rbac_id);
132 $this->setObjId($row->obj_id);
133 $this->setObjType($row->obj_type);
134 $this->setParentId($row->parent_id);
135 $this->setParentType($row->parent_type);
136 $this->setCatalog($row->catalog);
137 $this->setEntry($row->entry);
138 }
139 }
140 return true;
141 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)

References $ilDB, $query, $res, $row, DB_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:

◆ read() [2/2]

ilMDIdentifier::read ( )

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

122 {
123 global $ilDB;
124
125 if($this->getMetaId())
126 {
127 $query = "SELECT * FROM il_meta_identifier ".
128 "WHERE meta_identifier_id = ".$ilDB->quote($this->getMetaId());
129
130 $res = $this->db->query($query);
131 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
132 {
133 $this->setRBACId($row->rbac_id);
134 $this->setObjId($row->obj_id);
135 $this->setObjType($row->obj_type);
136 $this->setParentId($row->parent_id);
137 $this->setParentType($row->parent_type);
138 $this->setCatalog(ilUtil::stripSlashes($row->catalog));
139 $this->setEntry(ilUtil::stripSlashes($row->entry));
140 }
141 }
142 return true;
143 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ 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

return

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

281 {
282 global $ilDB;
283
284 $query = "SELECT * FROM il_meta_identifier ".
285 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id , 'integer').
286 " AND obj_type = ".$ilDB->quote($a_obj_type , 'text').
287 " AND catalog = ".$ilDB->quote($a_catalog , 'text').
288 " AND entry = ".$ilDB->quote($a_entry , 'text');
289 $s = $ilDB->query($query);
290 $data = array();
291 while ($r = $ilDB->fetchAssoc($s))
292 {
293 $data[] = $r;
294 }
295 return $data;
296 }
$data

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

Referenced by ilLMObject\getExportIDInfo().

+ Here is the caller graph for this function:

◆ save() [1/2]

ilMDIdentifier::save ( )

Reimplemented from ilMDBase.

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

62 {
63 global $ilDB;
64
65 $fields = $this->__getFields();
66 $fields['meta_identifier_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_identifier'));
67
68 if($this->db->insert('il_meta_identifier',$fields))
69 {
70 $this->setMetaId($next_id);
71 return $this->getMetaId();
72 }
73 return false;
74 }
setMetaId($a_meta_id, $a_read_data=true)

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

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDIdentifier::save ( )

Reimplemented from ilMDBase.

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

63 {
64 if($this->db->autoExecute('il_meta_identifier',
65 $this->__getFields(),
66 DB_AUTOQUERY_INSERT))
67 {
68 $this->setMetaId($this->db->getLastInsertId());
69
70 return $this->getMetaId();
71 }
72 return false;
73 }

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

+ Here is the call graph for this function:

◆ setCatalog() [1/2]

ilMDIdentifier::setCatalog (   $a_catalog)

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

44 {
45 $this->catalog = $a_catalog;
46 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCatalog() [2/2]

ilMDIdentifier::setCatalog (   $a_catalog)

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

45 {
46 $this->catalog = $a_catalog;
47 }

◆ setEntry() [1/2]

ilMDIdentifier::setEntry (   $a_entry)

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

52 {
53 $this->entry = $a_entry;
54 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setEntry() [2/2]

ilMDIdentifier::setEntry (   $a_entry)

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

53 {
54 $this->entry = $a_entry;
55 }

◆ toXML() [1/2]

ilMDIdentifier::toXML ( $writer)

Reimplemented from ilMDBase.

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

151 {
152 $writer->xmlElement('Identifier',array('Catalog' => $this->getCatalog(),
153 'Entry' => $this->getEntry()));
154 }

References getCatalog(), and getEntry().

+ Here is the call graph for this function:

◆ toXML() [2/2]

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

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

149 {
150 $entry_default = ($this->getObjId() == 0)
151 ? "il_".IL_INST_ID."_".$this->getObjType()."_".$this->getRBACId()
152 : "il_".IL_INST_ID."_".$this->getObjType()."_".$this->getObjId();
153
154 $entry = $this->getEntry() ? $this->getEntry() : $entry_default;
155 $catalog = $this->getCatalog();
156
157 if ($this->getExportMode() && $this->getCatalog() != "ILIAS_NID")
158 {
159 $entry = $entry_default;
160 $catalog = "ILIAS";
161 }
162
163 if(strlen($catalog))
164 {
165 $writer->xmlElement('Identifier',array('Catalog' => $catalog,
166 'Entry' => $entry));
167 }
168 else
169 {
170 $writer->xmlElement('Identifier',array('Entry' => $entry));
171 }
172 }

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

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDIdentifier::update ( )

Reimplemented from ilMDBase.

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

77 {
78 global $ilDB;
79
80 if($this->getMetaId())
81 {
82 if($this->db->update('il_meta_identifier',
83 $this->__getFields(),
84 array("meta_identifier_id" => array('integer',$this->getMetaId()))))
85 {
86 return true;
87 }
88 }
89 return false;
90 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDIdentifier::update ( )

Reimplemented from ilMDBase.

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

76 {
77 global $ilDB;
78
79 if($this->getMetaId())
80 {
81 if($this->db->autoExecute('il_meta_identifier',
82 $this->__getFields(),
83 DB_AUTOQUERY_UPDATE,
84 "meta_identifier_id = ".$ilDB->quote($this->getMetaId())))
85 {
86 return true;
87 }
88 }
89 return false;
90 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

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