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

Public Member Functions

 getPossibleSubelements ()
 
 getIdentifierIds ()
 
 getIdentifier (int $a_identifier_id)
 
 addIdentifier ()
 
 getContributeIds ()
 
 getContribute (int $a_contribute_id)
 
 addContribute ()
 
 setMetaDataScheme (string $a_val)
 
 getMetaDataScheme ()
 
 setLanguage (ilMDLanguageItem $lng_obj)
 
 getLanguage ()
 
 getLanguageCode ()
 
 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 _getId (int $a_rbac_id, int $a_obj_id)
 

Private Attributes

string $meta_data_scheme = 'LOM v 1.0'
 
ilMDLanguageItem $language = null
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields()

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

Definition at line 174 of file class.ilMDMetaMetadata.php.

174 : array
175 {
176 return array(
177 'rbac_id' => array('integer', $this->getRBACId()),
178 'obj_id' => array('integer', $this->getObjId()),
179 'obj_type' => array('text', $this->getObjType()),
180 'meta_data_scheme' => array('text', $this->getMetaDataScheme()),
181 'language' => array('text', $this->getLanguageCode())
182 );
183 }

References getLanguageCode(), getMetaDataScheme(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

Referenced by save(), and update().

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

◆ _getId()

static ilMDMetaMetadata::_getId ( int  $a_rbac_id,
int  $a_obj_id 
)
static

Definition at line 241 of file class.ilMDMetaMetadata.php.

241 : int
242 {
243 global $DIC;
244
245 $ilDB = $DIC->database();
246
247 $query = "SELECT meta_meta_data_id FROM il_meta_meta_data " .
248 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
249 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
250
251 $res = $ilDB->query($query);
252 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
253 return (int) $row->meta_meta_data_id;
254 }
255 return 0;
256 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD\getMetaMetadata().

+ Here is the caller graph for this function:

◆ addContribute()

ilMDMetaMetadata::addContribute ( )

Definition at line 91 of file class.ilMDMetaMetadata.php.

92 {
93 $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
94 $con->setParentId($this->getMetaId());
95 $con->setParentType('meta_meta_data');
96
97 return $con;
98 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ addIdentifier()

ilMDMetaMetadata::addIdentifier ( )

Definition at line 63 of file class.ilMDMetaMetadata.php.

64 {
65 $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
66 $ide->setParentId($this->getMetaId());
67 $ide->setParentType('meta_meta_data');
68
69 return $ide;
70 }

References ilMDBase\getMetaId(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

+ Here is the call graph for this function:

◆ delete()

ilMDMetaMetadata::delete ( )

Reimplemented from ilMDBase.

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

149 : bool
150 {
151 if ($this->getMetaId()) {
152 $query = "DELETE FROM il_meta_meta_data " .
153 "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
154 $res = $this->db->manipulate($query);
155
156 foreach ($this->getIdentifierIds() as $id) {
157 $ide = $this->getIdentifier($id);
158 $ide->delete();
159 }
160
161 foreach ($this->getContributeIds() as $id) {
162 $con = $this->getContribute($id);
163 $con->delete();
164 }
165 return true;
166 }
167
168 return false;
169 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getIdentifier(int $a_identifier_id)
getContribute(int $a_contribute_id)

References $id, $query, $res, getContribute(), getContributeIds(), getIdentifier(), getIdentifierIds(), and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getContribute()

ilMDMetaMetadata::getContribute ( int  $a_contribute_id)

Definition at line 80 of file class.ilMDMetaMetadata.php.

81 {
82 if (!$a_contribute_id) {
83 return null;
84 }
85 $con = new ilMDContribute();
86 $con->setMetaId($a_contribute_id);
87
88 return $con;
89 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getContributeIds()

ilMDMetaMetadata::getContributeIds ( )
Returns
int[]

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

75 : array
76 {
77 return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
78 }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)

References ilMDContribute\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

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

◆ getIdentifier()

ilMDMetaMetadata::getIdentifier ( int  $a_identifier_id)

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

53 {
54 if (!$a_identifier_id) {
55 return null;
56 }
57 $ide = new ilMDIdentifier();
58 $ide->setMetaId($a_identifier_id);
59
60 return $ide;
61 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getIdentifierIds()

ilMDMetaMetadata::getIdentifierIds ( )
Returns
int[]

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

47 : array
48 {
49 return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
50 }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)

References ilMDIdentifier\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

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

◆ getLanguage()

ilMDMetaMetadata::getLanguage ( )

Definition at line 118 of file class.ilMDMetaMetadata.php.

119 {
120 return is_object($this->language) ? $this->language : null;
121 }

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ getLanguageCode()

ilMDMetaMetadata::getLanguageCode ( )

Definition at line 123 of file class.ilMDMetaMetadata.php.

123 : string
124 {
125 return is_object($this->language) ? $this->language->getLanguageCode() : '';
126 }

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by __getFields(), and toXML().

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

◆ getMetaDataScheme()

ilMDMetaMetadata::getMetaDataScheme ( )

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

107 : string
108 {
109 // Fixed attribute
110 return 'LOM v 1.0';
111 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getPossibleSubelements()

ilMDMetaMetadata::getPossibleSubelements ( )
Returns
array<string, string>

Definition at line 34 of file class.ilMDMetaMetadata.php.

34 : array
35 {
36 $subs['Identifier'] = 'meta_identifier';
37 $subs['Contribute'] = 'meta_contribute';
38
39 return $subs;
40 }

◆ read()

ilMDMetaMetadata::read ( )

Reimplemented from ilMDBase.

Definition at line 185 of file class.ilMDMetaMetadata.php.

185 : bool
186 {
187 if ($this->getMetaId()) {
188 $query = "SELECT * FROM il_meta_meta_data " .
189 "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
190
191 $res = $this->db->query($query);
192 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
193 $this->setRBACId((int) $row->rbac_id);
194 $this->setObjId((int) $row->obj_id);
195 $this->setObjType($row->obj_type);
196 $this->setMetaDataScheme($row->meta_data_scheme ?? '');
197 $this->setLanguage(new ilMDLanguageItem($row->language ?? ''));
198 }
199 return true;
200 }
201 return false;
202 }
setObjType(string $a_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setMetaDataScheme(string $a_val)
setLanguage(ilMDLanguageItem $lng_obj)

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setLanguage(), setMetaDataScheme(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ save()

ilMDMetaMetadata::save ( )

Reimplemented from ilMDBase.

Definition at line 128 of file class.ilMDMetaMetadata.php.

128 : int
129 {
130 $fields = $this->__getFields();
131 $fields['meta_meta_data_id'] = array('integer', $next_id = $this->db->nextId('il_meta_meta_data'));
132
133 if ($this->db->insert('il_meta_meta_data', $fields)) {
134 $this->setMetaId($next_id);
135 return $this->getMetaId();
136 }
137 return 0;
138 }
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:

◆ setLanguage()

ilMDMetaMetadata::setLanguage ( ilMDLanguageItem  $lng_obj)

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

113 : void
114 {
115 $this->language = $lng_obj;
116 }

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by read().

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

◆ setMetaDataScheme()

ilMDMetaMetadata::setMetaDataScheme ( string  $a_val)

Definition at line 102 of file class.ilMDMetaMetadata.php.

102 : void
103 {
104 $this->meta_data_scheme = $a_val;
105 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDMetaMetadata::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

Definition at line 204 of file class.ilMDMetaMetadata.php.

204 : void
205 {
206 $attr = null;
207 if ($this->getMetaDataScheme()) {
208 $attr['MetadataScheme'] = $this->getMetaDataScheme();
209 }
210 if ($this->getLanguageCode()) {
211 $attr['Language'] = $this->getLanguageCode();
212 }
213 $writer->xmlStartTag('Meta-Metadata', $attr);
214
215 // ELEMENT IDENTIFIER
216 $identifiers = $this->getIdentifierIds();
217 foreach ($identifiers as $id) {
218 $ide = $this->getIdentifier($id);
219 $ide->toXML($writer);
220 }
221 if (!count($identifiers)) {
222 $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId());
223 $ide->toXML($writer);
224 }
225
226 // ELEMETN Contribute
227 $contributes = $this->getContributeIds();
228 foreach ($contributes as $id) {
229 $con = $this->getContribute($id);
230 $con->toXML($writer);
231 }
232 if (!count($contributes)) {
233 $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
234 $con->toXML($writer);
235 }
236
237 $writer->xmlEndTag('Meta-Metadata');
238 }
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References $id, getContribute(), getContributeIds(), getIdentifier(), getIdentifierIds(), getLanguageCode(), getMetaDataScheme(), ilMDBase\getObjId(), ilMDBase\getRBACId(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilMDMetaMetadata::update ( )

Reimplemented from ilMDBase.

Definition at line 140 of file class.ilMDMetaMetadata.php.

140 : bool
141 {
142 return $this->getMetaId() && $this->db->update(
143 'il_meta_meta_data',
144 $this->__getFields(),
145 array("meta_meta_data_id" => array('integer', $this->getMetaId()))
146 );
147 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $language

ilMDLanguageItem ilMDMetaMetadata::$language = null
private

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

◆ $meta_data_scheme

string ilMDMetaMetadata::$meta_data_scheme = 'LOM v 1.0'
private

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


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