19 declare(strict_types=1);
35 'collection' =>
'Collection',
36 'networked' =>
'Networked',
37 'hierarchical' =>
'Hierarchical',
58 $subs[
'Keyword'] =
'meta_keyword';
59 $subs[
'Language'] =
'meta_language';
60 $subs[
'Identifier'] =
'meta_identifier';
61 $subs[
'Description'] =
'meta_description';
78 if (!$a_identifier_id) {
82 $ide->setMetaId($a_identifier_id);
91 $ide->setParentType(
'meta_general');
106 if (!$a_language_id) {
110 $lan->setMetaId($a_language_id);
119 $lan->setParentType(
'meta_general');
134 if (!$a_description_id) {
138 $des->setMetaId($a_description_id);
147 $des->setParentType(
'meta_general');
162 if (!$a_keyword_id) {
166 $key->setMetaId($a_keyword_id);
175 $key->setParentType(
'meta_general');
183 switch ($a_structure) {
189 $this->structure = $a_structure;
204 $this->title = $a_title;
214 $this->title_language = $lng_obj;
219 return is_object($this->title_language) ? $this->title_language :
null;
224 return is_object($this->title_language) ? $this->title_language->getLanguageCode() :
'';
229 $this->coverage = $a_coverage;
239 $this->coverage_language = $lng_obj;
244 return is_object($this->coverage_language) ? $this->coverage_language :
null;
249 return is_object($this->coverage_language) ? $this->coverage_language->getLanguageCode() :
'';
255 $fields[
'meta_general_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_general'));
257 $this->log->debug(
"Insert General " . print_r($fields,
true));
261 if ($this->db->insert(
'il_meta_general', $fields)) {
277 return (
bool) $this->db->update(
280 array(
"meta_general_id" => array(
'integer', $this->
getMetaId()))
284 public function delete():
bool 314 $query =
"DELETE FROM il_meta_general " .
315 "WHERE meta_general_id = " . $this->db->quote($this->
getMetaId(),
'integer');
316 $res = $this->db->manipulate($query);
333 $structure = (string) array_search(
335 self::STRUCTURE_TRANSLATION
339 'rbac_id' => array(
'integer', $this->
getRBACId()),
340 'obj_id' => array(
'integer', $this->
getObjId()),
341 'obj_type' => array(
'text', $this->
getObjType()),
342 'general_structure' => array(
'text', $structure),
343 'title' => array(
'text', $this->
getTitle()),
353 $query =
"SELECT * FROM il_meta_general " .
354 "WHERE meta_general_id = " . $this->db->quote($this->
getMetaId(),
'integer');
356 $res = $this->db->query($query);
361 if (key_exists($row->general_structure ??
'', self::STRUCTURE_TRANSLATION)) {
362 $row->general_structure = self::STRUCTURE_TRANSLATION[$row->general_structure ??
''];
366 $this->
setObjId((
int) $row->obj_id);
369 $this->
setTitle((
string) $row->title);
389 foreach ($identifiers as
$id) {
392 $ide->toXML($writer);
395 if (!count($identifiers)) {
401 $ide->setExportMode(
true);
402 $ide->toXML($writer);
416 foreach ($languages as $id) {
418 $lan->toXML($writer);
423 foreach ($descriptions as $id) {
425 $des->toXML($writer);
427 if (!count($descriptions)) {
431 $des->toXML($writer);
436 foreach ($keywords as $id) {
438 $key->toXML($writer);
440 if (!count($keywords)) {
444 $key->toXML($writer);
461 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 465 $ilDB = $DIC->database();
467 $query =
"SELECT meta_general_id FROM il_meta_general " .
468 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
469 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
473 return (
int) $row->meta_general_id;
491 'meta_coverage_id' => [
'integer', $next_id = $this->db->nextId(
'il_meta_coverage')],
492 'rbac_id' => [
'integer', $this->
getRBACId()],
493 'obj_id' => [
'integer', $this->
getObjId()],
495 'parent_type' => [
'text',
'meta_general'],
496 'parent_id' => [
'integer', $this->
getMetaId()],
501 $this->coverage_id = $next_id;
520 $query =
"DELETE FROM il_meta_coverage WHERE parent_type = 'meta_general' 521 AND parent_id = " . $this->db->quote($this->
getMetaId(),
'integer');
522 $res = $this->db->manipulate($query);
530 $query =
"SELECT * FROM il_meta_coverage WHERE meta_coverage_id = " .
533 $res = $this->db->query($query);
534 if ($row = $this->db->fetchAssoc(
$res)) {
553 $query =
"SELECT meta_coverage_id FROM il_meta_coverage WHERE parent_type = 'meta_general' 554 AND parent_id = " . $this->db->quote($parent_id,
'integer') .
555 " ORDER BY meta_coverage_id";
557 $res = $this->db->query($query);
558 if ($row = $this->db->fetchAssoc(
$res)) {
559 $this->coverage_id = (
int) $row[
'meta_coverage_id'];
566 public function setMetaId(
int $a_meta_id,
bool $a_read_data =
true): void
569 parent::setMetaId($a_meta_id, $a_read_data);
int $coverage_id
Compatibility fix for legacy MD classes for new db tables.
getIdentifier(int $a_identifier_id)
getCoverageId()
Compatibility fix for legacy MD classes for new db tables.
setTitle(string $a_title)
deleteAllCoverages()
Compatibility fix for legacy MD classes for new db tables.
setStructure(string $a_structure)
readCoverageId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
static _getId(int $a_rbac_id, int $a_obj_id)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setCoverage(string $a_coverage)
ilMDLanguageItem $title_language
const ilMDLanguageItem $coverage_language
setMetaId(int $a_meta_id, bool $a_read_data=true)
Compatibility fix for legacy MD classes for new db tables.
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
getDescription(int $a_description_id)
getCoverageLanguageCode()
toXML(ilXmlWriter $writer)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
createOrUpdateCoverage()
Compatibility fix for legacy MD classes for new db tables.
readFirstCoverage()
Compatibility fix for legacy MD classes for new db tables.
setTitleLanguage(ilMDLanguageItem $lng_obj)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
getLanguage(int $a_language_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getKeyword(int $a_keyword_id)
const STRUCTURE_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
setCoverageLanguage(ilMDLanguageItem $lng_obj)
setObjType(string $a_type)