|
-
+
|
{FILE_NAME}
diff --git a/components/ILIAS/MediaPool/Clipboard/class.ilClipboardTableGUI.php b/components/ILIAS/MediaPool/Clipboard/class.ilClipboardTableGUI.php
index 983a5db58be0..409ce883a368 100755
--- a/components/ILIAS/MediaPool/Clipboard/class.ilClipboardTableGUI.php
+++ b/components/ILIAS/MediaPool/Clipboard/class.ilClipboardTableGUI.php
@@ -22,6 +22,7 @@
*/
class ilClipboardTableGUI extends ilTable2GUI
{
+ protected \ILIAS\MediaObjects\Thumbs\ThumbsGUI $thumbs_gui;
protected ilAccessHandler $access;
protected ilObjUser $user;
@@ -37,6 +38,7 @@ public function __construct(
$this->user = $DIC->user();
$ilCtrl = $DIC->ctrl();
$lng = $DIC->language();
+ $this->thumbs_gui = $DIC->mediaObjects()->internal()->gui()->thumbs();
parent::__construct($a_parent_obj, $a_parent_cmd);
$lng->loadLanguageModule("mep");
@@ -86,30 +88,10 @@ protected function fillRow(array $a_set): void
$mob = null;
if ($a_set["type"] === "mob") {
- // output thumbnail
- $mob = new ilObjMediaObject($a_set["id"]);
- $med = $mob->getMediaItem("Standard");
- $target = $med->getThumbnailTarget();
- if ($target !== "") {
- $this->tpl->setCurrentBlock("thumbnail");
- $this->tpl->setVariable("IMG_THUMB", $target);
- $this->tpl->parseCurrentBlock();
- }
- if (ilUtil::deducibleSize($med->getFormat()) &&
- $med->getLocationType() === "Reference") {
- $size = getimagesize($med->getLocation());
- if ($size[0] > 0 && $size[1] > 0) {
- $wr = $size[0] / 80;
- $hr = $size[1] / 80;
- $r = max($wr, $hr);
- $w = (int) ($size[0] / $r);
- $h = (int) ($size[1] / $r);
- $this->tpl->setVariable(
- "IMG",
- ilUtil::img($med->getLocation(), "", $w, $h)
- );
- }
- }
+ $this->tpl->setVariable(
+ "IMG",
+ $this->thumbs_gui->getThumbHtml((int) $a_set["id"])
+ );
} elseif ($a_set["type"] === "incl") {
$this->tpl->setCurrentBlock("thumbnail");
$this->tpl->setVariable(
diff --git a/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMaster.php b/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMaster.php
index 44fffbc81380..ee87b96bbb73 100644
--- a/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMaster.php
+++ b/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMaster.php
@@ -25,15 +25,18 @@
use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface as ilExportHandlerConsumerFileIdentifierCollectionInterface;
use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\HandlerInterface as ilExportHandlerConsumerFileIdentifierInterface;
use ILIAS\Export\ExportHandler\I\Info\File\CollectionInterface as ilExportHandlerFileInfoCollectionInterface;
+use ILIAS\ILIASObject\Properties\Translations\CachedRepository as TranslationsRepository;
use ILIAS\DI\Container;
class ilMediaPoolExportOptionXMLMaster extends ilBasicLegacyExportOption
{
protected ilLanguage $lng;
+ protected ilDBInterface $db;
public function init(Container $DIC): void
{
$this->lng = $DIC->language();
+ $this->db = $DIC->database();
parent::init($DIC);
}
@@ -150,8 +153,8 @@ public function getFiles(
public function isObjectSupported(
ObjectId $object_id
): bool {
- $ot = ilObjectTranslation::getInstance($object_id->toInt());
- return $ot->getContentActivated();
+ $ot = (new TranslationsRepository($this->db))->getFor($object_id->toInt());
+ return $ot->getContentTranslationActivated();
}
public function onExportOptionSelected(
diff --git a/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMasterNoMedia.php b/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMasterNoMedia.php
index 01c9d35e6037..22c260f0421c 100644
--- a/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMasterNoMedia.php
+++ b/components/ILIAS/MediaPool/classes/class.ilMediaPoolExportOptionXMLMasterNoMedia.php
@@ -25,15 +25,18 @@
use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface as ilExportHandlerConsumerFileIdentifierCollectionInterface;
use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\HandlerInterface as ilExportHandlerConsumerFileIdentifierInterface;
use ILIAS\Export\ExportHandler\I\Info\File\CollectionInterface as ilExportHandlerFileInfoCollectionInterface;
+use ILIAS\ILIASObject\Properties\Translations\CachedRepository as TranslationsRepository;
use ILIAS\DI\Container;
class ilMediaPoolExportOptionXMLMasterNoMedia extends ilBasicLegacyExportOption
{
protected ilLanguage $lng;
+ protected ilDBInterface $db;
public function init(Container $DIC): void
{
$this->lng = $DIC->language();
+ $this->db = $DIC->database();
parent::init($DIC);
}
@@ -135,8 +138,8 @@ public function getFiles(
public function isObjectSupported(ObjectId $object_id): bool
{
- $ot = ilObjectTranslation::getInstance($object_id->toInt());
- return $ot->getContentActivated();
+ $ot = (new TranslationsRepository($this->db))->getFor($object_id->toInt());
+ return $ot->getContentTranslationActivated();
}
public function onExportOptionSelected(ilExportHandlerConsumerContextInterface $context): void
diff --git a/components/ILIAS/MediaPool/classes/class.ilMediaPoolImportGUI.php b/components/ILIAS/MediaPool/classes/class.ilMediaPoolImportGUI.php
index d1a2a493ed16..9200fcf3d103 100755
--- a/components/ILIAS/MediaPool/classes/class.ilMediaPoolImportGUI.php
+++ b/components/ILIAS/MediaPool/classes/class.ilMediaPoolImportGUI.php
@@ -16,6 +16,8 @@
*
*********************************************************************/
+use ILIAS\ILIASObject\Properties\Translations\Translations;
+
/**
* Import related features for media pools (currently used for translation imports)
*
@@ -28,6 +30,7 @@ class ilMediaPoolImportGUI
protected ilCtrl $ctrl;
protected ilLanguage $lng;
protected ilGlobalTemplateInterface $tpl;
+ protected Translations $ot;
public function __construct(ilObjMediaPool $a_mep)
{
@@ -41,6 +44,7 @@ public function __construct(ilObjMediaPool $a_mep)
->internal()
->gui()
->standardRequest();
+ $this->ot = $a_mep->getObjectProperties()->getPropertyTranslations();
}
public function executeCommand(): void
@@ -80,10 +84,10 @@ public function initTranslationImportForm(): ilPropertyFormGUI
$fi->setSize(30);
$form->addItem($fi);
- $ot = ilObjectTranslation::getInstance($this->mep->getId());
+ $ot = $this->ot;
$options = [];
foreach ($ot->getLanguages() as $l) {
- if ($l->getLanguageCode() != $ot->getMasterLanguage()) {
+ if ($l->getLanguageCode() != $ot->getBaseLanguage()) {
$options[$l->getLanguageCode()] = $lng->txt("meta_l_" . $l->getLanguageCode());
}
}
@@ -109,8 +113,8 @@ public function importTranslation(): void
$conf = $imp->getConfig("components/ILIAS/MediaPool");
$target_lang = $this->request->getImportLang();
- $ot = ilObjectTranslation::getInstance($this->mep->getId());
- if ($target_lang === $ot->getMasterLanguage()) {
+ $ot = $this->ot;
+ if ($target_lang === $ot->getBaseLanguage()) {
$this->tpl->setOnScreenMessage('failure', $lng->txt("mep_transl_master_language_not_allowed"), true);
$ilCtrl->redirect($this, "showTranslationImportForm");
}
diff --git a/components/ILIAS/MediaPool/classes/class.ilMediaPoolTableGUI.php b/components/ILIAS/MediaPool/classes/class.ilMediaPoolTableGUI.php
index 0c24be6cd8ad..b7f8129bff1f 100755
--- a/components/ILIAS/MediaPool/classes/class.ilMediaPoolTableGUI.php
+++ b/components/ILIAS/MediaPool/classes/class.ilMediaPoolTableGUI.php
@@ -29,6 +29,7 @@ class ilMediaPoolTableGUI extends ilTable2GUI
public const IL_MEP_EDIT = "edit";
public const IL_MEP_SELECT_CONTENT = "selectc";
public const IL_MEP_SELECT_SINGLE = "selectsingle";
+ protected \ILIAS\MediaObjects\Thumbs\ThumbsGUI $thumbs_gui;
protected \ILIAS\DI\UIServices $ui;
protected string $mode = "";
@@ -203,6 +204,7 @@ public function __construct(
$ilAccess->checkAccess("write", "", $this->media_pool->getRefId())) {
$this->setSelectAllCheckbox("id");
}
+ $this->thumbs_gui = $DIC->mediaObjects()->internal()->gui()->thumbs();
}
protected function showAdvMetadata(): bool
@@ -512,45 +514,14 @@ protected function fillRow(array $a_set): void
// output thumbnail (or mob icon)
if (ilObject::_lookupType($a_set["foreign_id"]) === "mob") {
- $mob = new ilObjMediaObject($a_set["foreign_id"]);
- $med = $mob->getMediaItem("Standard");
- $target = "";
-
- // thumbnail picture
- if ($med) {
- $target = $med->getThumbnailTarget();
- }
-
- // video preview
- if ($target === "") {
- $target = $mob->getVideoPreviewPic();
- }
-
- if ($target !== "") {
- $this->tpl->setVariable("IMG", ilUtil::img($target));
- } else {
- $this->tpl->setVariable(
- "IMG",
- ilUtil::img(ilUtil::getImagePath("standard/icon_" . $a_set["type"] . ".svg"))
- );
- }
- if ($med && ilUtil::deducibleSize($med->getFormat()) &&
- $med->getLocationType() === "Reference") {
- $size = getimagesize($med->getLocation());
- if ($size[0] > 0 && $size[1] > 0) {
- $wr = $size[0] / 80;
- $hr = $size[1] / 80;
- $r = max($wr, $hr);
- $w = (int) ($size[0] / $r);
- $h = (int) ($size[1] / $r);
- $this->tpl->setVariable(
- "IMG",
- ilUtil::img($med->getLocation(), "", $w, $h)
- );
- }
- }
+ $mob_id = (int) $a_set["foreign_id"];
+ $this->tpl->setVariable(
+ "IMG",
+ $this->thumbs_gui->getThumbHtml($mob_id)
+ );
// output media info
+ $mob = new ilObjMediaObject($mob_id);
$this->tpl->setVariable(
"MEDIA_INFO",
ilObjMediaObjectGUI::_getMediaInfoHTML($mob)
diff --git a/components/ILIAS/MediaPool/classes/class.ilObjMediaPool.php b/components/ILIAS/MediaPool/classes/class.ilObjMediaPool.php
index 95cadcc1b9e5..f646f65a7184 100755
--- a/components/ILIAS/MediaPool/classes/class.ilObjMediaPool.php
+++ b/components/ILIAS/MediaPool/classes/class.ilObjMediaPool.php
@@ -439,7 +439,6 @@ public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree =
/** @var ilObjMediaPool $new_obj */
$new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
- $new_obj->setTitle($this->getTitle());
$new_obj->setDescription($this->getDescription());
$new_obj->setDefaultWidth($this->getDefaultWidth());
$new_obj->setDefaultHeight($this->getDefaultHeight());
diff --git a/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolGUI.php b/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolGUI.php
index 119b992338e6..9939f041ead9 100755
--- a/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolGUI.php
+++ b/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolGUI.php
@@ -25,6 +25,7 @@
use ILIAS\MediaPool\InternalGUIService;
use ILIAS\FileUpload\Handler\HandlerResult;
use ILIAS\MediaPool\Settings\SettingsGUI;
+use ILIAS\ILIASObject\Properties\Translations\TranslationGUI;
/**
* User Interface class for media pool objects
@@ -33,7 +34,7 @@
*
* @ilCtrl_Calls ilObjMediaPoolGUI: ilObjMediaObjectGUI, ilObjFolderGUI, ilEditClipboardGUI, ilPermissionGUI
* @ilCtrl_Calls ilObjMediaPoolGUI: ilInfoScreenGUI, ilMediaPoolPageGUI, ilExportGUI
- * @ilCtrl_Calls ilObjMediaPoolGUI: ilCommonActionDispatcherGUI, ilObjectCopyGUI, ilObjectTranslationGUI, ilMediaPoolImportGUI
+ * @ilCtrl_Calls ilObjMediaPoolGUI: ilCommonActionDispatcherGUI, ilObjectCopyGUI, ILIAS\ILIASObject\Properties\Translations\TranslationGUI, ilMediaPoolImportGUI
* @ilCtrl_Calls ilObjMediaPoolGUI: ilObjectMetaDataGUI
* @ilCtrl_Calls ilObjMediaPoolGUI: ilMobMultiSrtUploadGUI, ilObjectMetaDataGUI, ilRepoStandardUploadHandlerGUI, ilMediaCreationGUI
* @ilCtrl_Calls ilObjMediaPoolGUI: ILIAS\MediaPool\Settings\SettingsGUI
@@ -53,6 +54,7 @@ class ilObjMediaPoolGUI extends ilObject2GUI
protected ilGlobalTemplateInterface $main_tpl;
protected FileUpload $upload;
protected ilLogger $mep_log;
+ protected ilDBInterface $db;
public bool $output_prepared;
public function __construct(
@@ -80,6 +82,7 @@ public function __construct(
$this->mep_log = ilLoggerFactory::getLogger("mep");
+ $this->db = $DIC->database();
$this->mode = ($this->mep_request->getMode() !== "")
? $this->mep_request->getMode()
@@ -392,14 +395,26 @@ public function executeCommand(): void
$this->ctrl->forwardCommand($gui);
break;
- case 'ilobjecttranslationgui':
+ case strtolower(TranslationGUI::class):
$this->prepareOutput();
$this->addHeaderAction();
//$this->setTabs("settings");
$ilTabs->activateTab("settings");
$this->setSettingsSubTabs("obj_multilinguality");
- $transgui = new ilObjectTranslationGUI($this);
- $transgui->setTitleDescrOnlyMode(false);
+ $transgui = new TranslationGUI(
+ $this->getObject(),
+ $this->lng,
+ $this->access,
+ $this->user,
+ $this->ctrl,
+ $this->tpl,
+ $this->ui_factory,
+ $this->ui_renderer,
+ $this->http,
+ $this->refinery,
+ $this->toolbar
+ );
+ $transgui->forceContentTranslation();
$this->ctrl->forwardCommand($transgui);
$this->tpl->printToStdout();
break;
@@ -1230,7 +1245,7 @@ public function setSettingsSubTabs(
if ($mset->get("mep_activate_pages")) {
$ilTabs->addSubTabTarget(
"obj_multilinguality",
- $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
+ $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "")
);
}
}
@@ -1414,9 +1429,9 @@ public static function getPreviewModalHTML(
public function export(): void
{
- $ot = ilObjectTranslation::getInstance($this->object->getId());
+ $ot = $this->object->getObjectProperties()->getPropertyTranslations();
$opt = "";
- if ($ot->getContentActivated()) {
+ if ($ot->getContentTranslationActivated()) {
$format = explode("_", $this->mep_request->getExportFormat());
$opt = ilUtil::stripSlashes($format[1]);
}
@@ -1470,6 +1485,15 @@ protected function handleUploadResult(
$mob->setDescription("");
$mob->create();
+ $media_item = $mob->addMediaItemFromUpload(
+ "Standard",
+ $result,
+ $this->mep_request->getUploadHash()
+ );
+
+ $mob->update();
+
+ /*
$mob->createDirectory();
$media_item = new ilMediaItem();
$mob->addMediaItem($media_item);
@@ -1485,7 +1509,13 @@ protected function handleUploadResult(
Location::WEB,
$file_name,
true
- );
+ );*/
+
+ // duration
+ $med_item = $mob->getMediaItem("Standard");
+ $med_item->determineDuration();
+ $med_item->update();
+
$mep_item = new ilMediaPoolItem();
$mep_item->setTitle($title);
@@ -1498,6 +1528,7 @@ protected function handleUploadResult(
$tree->insertNode($mep_item->getId(), $parent);
// get mime type
+ /*
$format = ilObjMediaObject::getMimeType($file);
$location = $file_name;
@@ -1506,17 +1537,19 @@ protected function handleUploadResult(
$media_item->setLocation($location);
$media_item->setLocationType("LocalFile");
$media_item->setUploadHash($this->mep_request->getUploadHash());
- $mob->update();
+ $mob->update();*/
$item_ids[] = $mob->getId();
+ /*
$mob = new ilObjMediaObject($mob->getId());
- $mob->generatePreviewPic(320, 240);
+ $mob->generatePreviewPic(320, 240);*/
// duration
+ /*
$med_item = $mob->getMediaItem("Standard");
$med_item->determineDuration();
- $med_item->update();
+ $med_item->update();*/
return new BasicHandlerResult(
"mep_id",
diff --git a/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolSubItemListGUI.php b/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolSubItemListGUI.php
index 7249475d06d8..f3fa2f3437d7 100755
--- a/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolSubItemListGUI.php
+++ b/components/ILIAS/MediaPool/classes/class.ilObjMediaPoolSubItemListGUI.php
@@ -89,41 +89,17 @@ public function getHTML(): string
protected function parseImage(int $a_sub_id): bool
{
+ global $DIC;
+ $thumbs_gui = $DIC->mediaObjects()->internal()->gui()->thumbs();
+
$sub_id = ilMediaPoolItem::lookupForeignId($a_sub_id);
// output thumbnail (or mob icon)
if (ilObject::_lookupType($sub_id) === "mob") {
$mob = new ilObjMediaObject($sub_id);
- $med = $mob->getMediaItem("Standard");
- $target = $med->getThumbnailTarget();
-
- if ($target != "") {
- // begin-patch mime_filter
- $this->tpl->setVariable(
- 'LINKED_LINK',
- ilLink::_getLink(
- $this->getRefId(),
- 'mep',
- array('action' => 'showMedia', 'mob_id' => $sub_id,'mepitem_id' => $a_sub_id)
- )
- );
- $this->tpl->setVariable('LINKED_TARGET', '_blank');
- $this->tpl->setVariable("LINKED_IMAGE", ilUtil::img($target));
- // end-patch mime_filter
- } else {
- $this->tpl->setVariable("SUB_ITEM_IMAGE", ilUtil::img(ilUtil::getImagePath("standard/icon_" . "mob" . ".gif")));
- }
- if (ilUtil::deducibleSize($med->getFormat()) && $med->getLocationType() === "Reference") {
- $size = getimagesize($med->getLocation());
- if ($size[0] > 0 && $size[1] > 0) {
- $wr = $size[0] / 80;
- $hr = $size[1] / 80;
- $r = max($wr, $hr);
- $w = (int) ($size[0] / $r);
- $h = (int) ($size[1] / $r);
- $this->tpl->setVariable("SUB_ITEM_IMAGE", ilUtil::img($med->getLocation(), "", $w, $h));
- return true;
- }
- }
+ $this->tpl->setVariable(
+ "SUB_ITEM_IMAGE",
+ $thumbs_gui->getThumbHtml($sub_id)
+ );
}
return false;
}
diff --git a/components/ILIAS/MediaPool/templates/default/tpl.mep_list_row.html b/components/ILIAS/MediaPool/templates/default/tpl.mep_list_row.html
index 92aea5341969..399b75069190 100755
--- a/components/ILIAS/MediaPool/templates/default/tpl.mep_list_row.html
+++ b/components/ILIAS/MediaPool/templates/default/tpl.mep_list_row.html
@@ -7,7 +7,7 @@
|
-
+ |
{IMG}
|
diff --git a/components/ILIAS/Membership/classes/class.ilAttendanceList.php b/components/ILIAS/Membership/classes/class.ilAttendanceList.php
index d7561eb44014..d8ea508e411c 100755
--- a/components/ILIAS/Membership/classes/class.ilAttendanceList.php
+++ b/components/ILIAS/Membership/classes/class.ilAttendanceList.php
@@ -607,7 +607,7 @@ public function getHTML(): string
if (!$this->has_local_role) {
$valid_user_ids = array_merge($valid_user_ids, $members);
} else {
- $valid_user_ids = array_merge($valid_user_ids, (array) $members[$role_id]);
+ $valid_user_ids = array_merge($valid_user_ids, (array) ($members[$role_id] ?? []));
}
break;
}
diff --git a/components/ILIAS/Membership/classes/class.ilMembershipGUI.php b/components/ILIAS/Membership/classes/class.ilMembershipGUI.php
index 427b08936956..4903bef475bc 100755
--- a/components/ILIAS/Membership/classes/class.ilMembershipGUI.php
+++ b/components/ILIAS/Membership/classes/class.ilMembershipGUI.php
@@ -1,4 +1,5 @@
tpl->setOnScreenMessage('success', $this->lng->txt("crs_users_added"), true);
} else {
- $this->tpl->setOnScreenMessage('failure', $this->lng->txt("crs_users_already_assigned"), true);
+ $this->tpl->setOnScreenMessage('info', $this->lng->txt("crs_users_already_assigned"), true);
}
$this->ctrl->redirect($this, 'participants');
}
diff --git a/components/ILIAS/Membership/classes/class.ilParticipants.php b/components/ILIAS/Membership/classes/class.ilParticipants.php
index d71983fd240a..ed38e4fb6513 100755
--- a/components/ILIAS/Membership/classes/class.ilParticipants.php
+++ b/components/ILIAS/Membership/classes/class.ilParticipants.php
@@ -108,8 +108,8 @@ public static function getInstance(int $a_ref_id): ilParticipants
case 'sess':
return ilSessionParticipants::getInstance($a_ref_id);
default:
- $logger()->mem()->logStack();
- $logger()->mem()->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
+ $logger->logStack();
+ $logger->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
throw new InvalidArgumentException('Invalid obj_id given.');
}
}
@@ -689,7 +689,7 @@ public function checkLastAdmin(array $a_usr_ids): bool
public function isBlocked(int $a_usr_id): bool
{
if (isset($this->participants_status[$a_usr_id])) {
- return (bool) $this->participants_status[$a_usr_id]['blocked'];
+ return (bool) ($this->participants_status[$a_usr_id]['blocked'] ?? false);
}
return false;
}
@@ -700,7 +700,7 @@ public function isBlocked(int $a_usr_id): bool
public function hasPassed(int $a_usr_id): bool
{
if (isset($this->participants_status[$a_usr_id])) {
- return (bool) $this->participants_status[$a_usr_id]['passed'];
+ return (bool) ($this->participants_status[$a_usr_id]['passed'] ?? false);
}
return false;
}
@@ -886,7 +886,7 @@ public function addRecommendation(int $a_usr_id): void
public function isNotificationEnabled(int $a_usr_id): bool
{
if (isset($this->participants_status[$a_usr_id])) {
- return (bool) $this->participants_status[$a_usr_id]['notification'];
+ return (bool) ($this->participants_status[$a_usr_id]['notification'] ?? false);
}
return false;
}
@@ -894,7 +894,7 @@ public function isNotificationEnabled(int $a_usr_id): bool
public function isContact(int $a_usr_id): bool
{
if (isset($this->participants_status[$a_usr_id])) {
- return (bool) $this->participants_status[$a_usr_id]['contact'];
+ return (bool) ($this->participants_status[$a_usr_id]['contact'] ?? false);
}
return false;
}
diff --git a/components/ILIAS/MetaData/ROADMAP.md b/components/ILIAS/MetaData/ROADMAP.md
index c78b79ef117f..b56168873cb8 100755
--- a/components/ILIAS/MetaData/ROADMAP.md
+++ b/components/ILIAS/MetaData/ROADMAP.md
@@ -67,15 +67,6 @@ The `Derivator` in the API could be expanded to contain methods like
LOM set before it is persisted. The repository would need to take into
account more types of markers/scaffolds in `transferMD`.
-### Abandon the old backend
-
-All ILIAS components using MD should at some point only use the
-new classes as the new MD editor does.
-
-Only a few usages of the deprecated classes remain, most of these
-related to export/import. Those and all deprecated classes will be
-removed with ILIAS 10.
-
### Customizable LOM Digest
Customizing of LOM Digest could be made possible for plugins, in
diff --git a/components/ILIAS/MetaData/classes/Editor/Digest/ContentAssembler.php b/components/ILIAS/MetaData/classes/Editor/Digest/ContentAssembler.php
index 85932094193b..a3723a8a2ad5 100755
--- a/components/ILIAS/MetaData/classes/Editor/Digest/ContentAssembler.php
+++ b/components/ILIAS/MetaData/classes/Editor/Digest/ContentAssembler.php
@@ -38,18 +38,18 @@
class ContentAssembler
{
// post variables
- public const KEYWORDS = 'keywords';
- public const GENERAL = 'general';
- public const AUTHORS = 'authors';
- public const RIGHTS = 'rights';
- public const TYPICAL_LEARNING_TIME = 'tlt';
- public const FIRST_AUTHOR = 'first_author';
- public const SECOND_AUTHOR = 'second_author';
- public const THIRD_AUTHOR = 'third_author';
-
- public const CUSTOM_CP = 'custom_cp';
- public const CUSTOM_CP_DESCRIPTION = 'custom_cp_description';
- public const OER_BLOCKED = 'oer_blocked_';
+ public const string KEYWORDS = 'keywords';
+ public const string GENERAL = 'general';
+ public const string AUTHORS = 'authors';
+ public const string RIGHTS = 'rights';
+ public const string TYPICAL_LEARNING_TIME = 'tlt';
+ public const string FIRST_AUTHOR = 'first_author';
+ public const string SECOND_AUTHOR = 'second_author';
+ public const string THIRD_AUTHOR = 'third_author';
+
+ public const string CUSTOM_CP = 'custom_cp';
+ public const string CUSTOM_CP_DESCRIPTION = 'custom_cp_description';
+ public const string OER_BLOCKED = 'oer_blocked_';
protected PathFactory $path_factory;
protected NavigatorFactoryInterface $navigator_factory;
diff --git a/components/ILIAS/MetaData/classes/Editor/Digest/ManipulatorAdapter.php b/components/ILIAS/MetaData/classes/Editor/Digest/ManipulatorAdapter.php
index f4d4e756d185..5bcca30dd53b 100755
--- a/components/ILIAS/MetaData/classes/Editor/Digest/ManipulatorAdapter.php
+++ b/components/ILIAS/MetaData/classes/Editor/Digest/ManipulatorAdapter.php
@@ -25,7 +25,6 @@
use ILIAS\MetaData\Paths\FactoryInterface as PathFactory;
use ILIAS\MetaData\Paths\Navigator\NavigatorFactoryInterface;
use ILIAS\MetaData\Editor\Manipulator\ManipulatorInterface;
-use ILIAS\MetaData\Vocabularies\Standard\Dictionary\LOMDictionaryInitiator;
use ILIAS\MetaData\Vocabularies\Factory\Factory;
use ILIAS\MetaData\Vocabularies\Factory\FactoryInterface;
diff --git a/components/ILIAS/MetaData/classes/Editor/Full/FullEditor.php b/components/ILIAS/MetaData/classes/Editor/Full/FullEditor.php
index 57f66bce30a9..cd903e38f1e8 100755
--- a/components/ILIAS/MetaData/classes/Editor/Full/FullEditor.php
+++ b/components/ILIAS/MetaData/classes/Editor/Full/FullEditor.php
@@ -37,10 +37,10 @@
class FullEditor
{
- public const TABLE = 'table';
- public const PANEL = 'panel';
- public const ROOT = 'root';
- public const FORM = 'form';
+ public const string TABLE = 'table';
+ public const string PANEL = 'panel';
+ public const string ROOT = 'root';
+ public const string FORM = 'form';
protected EditorDictionaryInterface $editor_dictionary;
protected NavigatorFactoryInterface $navigator_factory;
diff --git a/components/ILIAS/MetaData/classes/Editor/Full/Services/Actions/ModalFactory.php b/components/ILIAS/MetaData/classes/Editor/Full/Services/Actions/ModalFactory.php
index 575cee49abf6..5777efde2b61 100755
--- a/components/ILIAS/MetaData/classes/Editor/Full/Services/Actions/ModalFactory.php
+++ b/components/ILIAS/MetaData/classes/Editor/Full/Services/Actions/ModalFactory.php
@@ -38,7 +38,7 @@
class ModalFactory
{
- public const MAX_LENGTH = 128;
+ public const int MAX_LENGTH = 128;
protected LinkProvider $link_provider;
protected UIFactory $factory;
@@ -118,7 +118,7 @@ public function update(
$to_be_updated,
false
);
- $modal = $this->getRoundtripModal(
+ $modal = $this->getRoundtripModal(
$to_be_updated,
$form,
Command::UPDATE_FULL,
diff --git a/components/ILIAS/MetaData/classes/Editor/Full/TableContent.php b/components/ILIAS/MetaData/classes/Editor/Full/TableContent.php
index 8911aaf0a9a9..a7646785d973 100755
--- a/components/ILIAS/MetaData/classes/Editor/Full/TableContent.php
+++ b/components/ILIAS/MetaData/classes/Editor/Full/TableContent.php
@@ -51,7 +51,7 @@ public function content(
$request,
...$elements
);
- $builder = $this->services->tableFactory()->table();
+ $builder = $this->services->tableFactory()->table();
$delete_buttons = [];
$update_buttons = [];
foreach ($elements as $element) {
diff --git a/components/ILIAS/MetaData/classes/Editor/Presenter/Data.php b/components/ILIAS/MetaData/classes/Editor/Presenter/Data.php
index 88b42d06d9eb..924d3f03ae5f 100755
--- a/components/ILIAS/MetaData/classes/Editor/Presenter/Data.php
+++ b/components/ILIAS/MetaData/classes/Editor/Presenter/Data.php
@@ -27,6 +27,7 @@
use ILIAS\MetaData\Vocabularies\Slots\Identifier as SlotIdentifier;
use ILIAS\MetaData\Vocabularies\Dispatch\Presentation\PresentationInterface as VocabulariesPresentation;
use ILIAS\MetaData\Vocabularies\Dispatch\Presentation\LabelledValueInterface;
+use ILIAS\MetaData\Vocabularies\Dispatch\Presentation\LabelledValue;
class Data implements DataInterface
{
@@ -46,35 +47,49 @@ public function __construct(
public function dataValue(ElementsDataInterface $data): string
{
- return $this->data_presentation->dataValue($data);
+ return $this->utilities->sanitizeForHTML(
+ $this->data_presentation->dataValue($data)
+ );
}
/**
- * @return string[] with values as keys
+ * @return LabelledValueInterface[]
*/
public function vocabularyValues(SlotIdentifier $slot, string ...$values): \Generator
{
- yield from $this->vocabularies_presentation->presentableLabels(
+ $labels = $this->vocabularies_presentation->presentableLabels(
$this->utilities,
$slot,
true,
...$values
);
+ foreach ($labels as $label) {
+ yield new LabelledValue(
+ $label->value(),
+ $this->utilities->sanitizeForHTML($label->label())
+ );
+ }
}
public function language(string $language): string
{
- return $this->data_presentation->language($language);
+ return $this->utilities->sanitizeForHTML(
+ $this->data_presentation->language($language)
+ );
}
public function datetime(string $datetime): string
{
- return $this->data_presentation->datetime($datetime);
+ return $this->utilities->sanitizeForHTML(
+ $this->data_presentation->datetime($datetime)
+ );
}
public function duration(string $duration): string
{
- return $this->data_presentation->duration($duration);
+ return $this->utilities->sanitizeForHTML(
+ $this->data_presentation->duration($duration)
+ );
}
/**
diff --git a/components/ILIAS/MetaData/classes/Editor/Presenter/Utilities.php b/components/ILIAS/MetaData/classes/Editor/Presenter/Utilities.php
index 60dd279c4765..3b1f3d652105 100755
--- a/components/ILIAS/MetaData/classes/Editor/Presenter/Utilities.php
+++ b/components/ILIAS/MetaData/classes/Editor/Presenter/Utilities.php
@@ -58,4 +58,9 @@ public function txtFill(string $key, string ...$values): string
{
return $this->utilities->txtFill($key, ...$values);
}
+
+ public function sanitizeForHTML(string $string): string
+ {
+ return $this->utilities->sanitizeForHTML($string);
+ }
}
diff --git a/components/ILIAS/MetaData/classes/Editor/Presenter/UtilitiesInterface.php b/components/ILIAS/MetaData/classes/Editor/Presenter/UtilitiesInterface.php
index 2839ad600ea8..eac7e7aad11c 100755
--- a/components/ILIAS/MetaData/classes/Editor/Presenter/UtilitiesInterface.php
+++ b/components/ILIAS/MetaData/classes/Editor/Presenter/UtilitiesInterface.php
@@ -34,4 +34,6 @@ public function getUserDateFormat(): DateFormat;
public function txt(string $key): string;
public function txtFill(string $key, string ...$values): string;
+
+ public function sanitizeForHTML(string $string): string;
}
diff --git a/components/ILIAS/MetaData/classes/Editor/Tree/MDEditorToolProvider.php b/components/ILIAS/MetaData/classes/Editor/Tree/MDEditorToolProvider.php
index 29118eba92bd..6cb920e8b8ac 100755
--- a/components/ILIAS/MetaData/classes/Editor/Tree/MDEditorToolProvider.php
+++ b/components/ILIAS/MetaData/classes/Editor/Tree/MDEditorToolProvider.php
@@ -97,7 +97,7 @@ protected function buildTreeAsTool(SetInterface $set, PathInterface $path): Tool
$lng->txt('meta_lom_short')
)
)
- ->withContent($this->services->dic()->ui()->factory()->legacy(
+ ->withContent($this->services->dic()->ui()->factory()->legacy()->content(
$this->services->dic()->ui()->renderer()->render($this->getUITree(
$set,
$path
diff --git a/components/ILIAS/MetaData/classes/Editor/class.ilMDEditorGUI.php b/components/ILIAS/MetaData/classes/Editor/class.ilMDEditorGUI.php
index c69e0bdbea3a..a46eef92bb2b 100755
--- a/components/ILIAS/MetaData/classes/Editor/class.ilMDEditorGUI.php
+++ b/components/ILIAS/MetaData/classes/Editor/class.ilMDEditorGUI.php
@@ -44,8 +44,8 @@
*/
class ilMDEditorGUI
{
- public const SET_FOR_TREE = 'md_set_for_tree';
- public const PATH_FOR_TREE = 'md_path_for_tree';
+ public const string SET_FOR_TREE = 'md_set_for_tree';
+ public const string PATH_FOR_TREE = 'md_path_for_tree';
protected FullEditorInitiator $full_editor_initiator;
protected DigestInitiator $digest_initiator;
@@ -112,14 +112,14 @@ public function executeCommand(): void
public function debug(): bool
{
- $button = $this->renderButtonToFullEditor();
-
$xml = $this->xml_writer->write($this->repository->getMD($this->obj_id, $this->sub_id, $this->type));
$dom = new DOMDocument('1.0');
$dom->formatOutput = true;
$dom->preserveWhiteSpace = false;
$dom->loadXML($xml->asXML());
- $this->tpl->setContent($button . '' . htmlentities($dom->saveXML()) . ' ');
+
+ $this->addButtonToFullEditor();
+ $this->tpl->setContent('' . htmlentities($dom->saveXML()) . ' ');
return true;
}
@@ -195,10 +195,8 @@ protected function renderDigest(
break;
}
}
- $this->tpl->setContent(
- $this->renderButtonToFullEditor() .
- $this->ui_renderer->render($template_content)
- );
+ $this->addButtonToFullEditor();
+ $this->tpl->setContent($this->ui_renderer->render($template_content));
}
protected function fullEditorCreate(): void
@@ -386,29 +384,20 @@ protected function setTabsForFullEditor(): void
);
}
- protected function renderButtonToFullEditor(): string
+ protected function addButtonToFullEditor(): void
{
- $bulky = $this->ui_factory->button()->bulky(
- $this->ui_factory->symbol()->icon()->standard(
- 'mds',
- $this->presenter->utilities()->txt('meta_button_to_full_editor_label'),
- 'medium'
- ),
+ $editor = $this->ui_factory->button()->standard(
$this->presenter->utilities()->txt('meta_button_to_full_editor_label'),
$this->ctrl->getLinkTarget($this, 'fullEditor')
);
+ $this->toolbar->addComponent($editor);
if (DEVMODE) {
- $debug = $this->ui_factory->button()->bulky(
- $this->ui_factory->symbol()->icon()->standard(
- 'adm',
- 'Debug'
- ),
+ $debug = $this->ui_factory->button()->standard(
'Debug',
$this->ctrl->getLinkTarget($this, 'debug')
);
+ $this->toolbar->addComponent($debug);
}
- return $this->ui_renderer->render($bulky) .
- (isset($debug) ? '' . $this->ui_renderer->render($debug) : '');
}
protected function checkAccess(): void
diff --git a/components/ILIAS/MetaData/classes/Elements/RessourceID/RessourceID.php b/components/ILIAS/MetaData/classes/Elements/RessourceID/RessourceID.php
index 47fd71b7988e..509fc726c629 100755
--- a/components/ILIAS/MetaData/classes/Elements/RessourceID/RessourceID.php
+++ b/components/ILIAS/MetaData/classes/Elements/RessourceID/RessourceID.php
@@ -32,7 +32,7 @@ public function __construct(
string $type
) {
$this->obj_id = $obj_id;
- $this->sub_id =$sub_id;
+ $this->sub_id = $sub_id;
$this->type = $type;
}
diff --git a/components/ILIAS/MetaData/classes/Manipulator/Manipulator.php b/components/ILIAS/MetaData/classes/Manipulator/Manipulator.php
index 9bb894f17be9..23cedbd2e047 100755
--- a/components/ILIAS/MetaData/classes/Manipulator/Manipulator.php
+++ b/components/ILIAS/MetaData/classes/Manipulator/Manipulator.php
@@ -164,7 +164,6 @@ protected function getElementsToUpdate(
$root
);
}
- continue;
}
}
@@ -244,7 +243,6 @@ protected function getElementsToCreate(
$root
);
}
- continue;
}
}
diff --git a/components/ILIAS/MetaData/classes/Paths/Navigator/BaseNavigator.php b/components/ILIAS/MetaData/classes/Paths/Navigator/BaseNavigator.php
index 1496ef897d1c..00c310a66a2f 100755
--- a/components/ILIAS/MetaData/classes/Paths/Navigator/BaseNavigator.php
+++ b/components/ILIAS/MetaData/classes/Paths/Navigator/BaseNavigator.php
@@ -99,7 +99,7 @@ public function nextStep(): ?BaseNavigatorInterface
public function previousStep(): ?BaseNavigatorInterface
{
- if(empty($this->previous_steps)) {
+ if (empty($this->previous_steps)) {
return null;
}
$clone = clone $this;
diff --git a/components/ILIAS/MetaData/classes/Presentation/NullUtilities.php b/components/ILIAS/MetaData/classes/Presentation/NullUtilities.php
index 2d3c4ae4ad4b..101fb247cef1 100755
--- a/components/ILIAS/MetaData/classes/Presentation/NullUtilities.php
+++ b/components/ILIAS/MetaData/classes/Presentation/NullUtilities.php
@@ -38,4 +38,9 @@ public function txtFill(string $key, string ...$values): string
{
return '';
}
+
+ public function sanitizeForHTML(string $string): string
+ {
+ return '';
+ }
}
diff --git a/components/ILIAS/MetaData/classes/Presentation/Services/Services.php b/components/ILIAS/MetaData/classes/Presentation/Services/Services.php
index b194248e6542..fc1fba670d16 100755
--- a/components/ILIAS/MetaData/classes/Presentation/Services/Services.php
+++ b/components/ILIAS/MetaData/classes/Presentation/Services/Services.php
@@ -57,7 +57,8 @@ public function utilities(): UtilitiesInterface
}
return $this->utilities = new Utilities(
$this->dic->language(),
- $this->dic->user()
+ $this->dic->user(),
+ $this->dic->refinery()
);
}
diff --git a/components/ILIAS/MetaData/classes/Presentation/Utilities.php b/components/ILIAS/MetaData/classes/Presentation/Utilities.php
index e164073f7d38..9372d8d7ca3e 100755
--- a/components/ILIAS/MetaData/classes/Presentation/Utilities.php
+++ b/components/ILIAS/MetaData/classes/Presentation/Utilities.php
@@ -21,19 +21,23 @@
namespace ILIAS\MetaData\Presentation;
use ILIAS\Data\DateFormat\DateFormat;
+use ILIAS\Refinery\Factory as Refinery;
class Utilities implements UtilitiesInterface
{
protected \ilLanguage $lng;
protected \ilObjUser $user;
+ protected Refinery $refinery;
public function __construct(
\ilLanguage $lng,
\ilObjUser $user,
+ Refinery $refinery
) {
$this->lng = $lng;
$this->lng->loadLanguageModule('meta');
$this->user = $user;
+ $this->refinery = $refinery;
}
public function getUserDateFormat(): DateFormat
@@ -53,4 +57,9 @@ public function txtFill(string $key, string ...$values): string
}
return $key . ' ' . implode(', ', $values);
}
+
+ public function sanitizeForHTML(string $string): string
+ {
+ return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($string);
+ }
}
diff --git a/components/ILIAS/MetaData/classes/Presentation/UtilitiesInterface.php b/components/ILIAS/MetaData/classes/Presentation/UtilitiesInterface.php
index df5f8840458d..a71ccab27184 100755
--- a/components/ILIAS/MetaData/classes/Presentation/UtilitiesInterface.php
+++ b/components/ILIAS/MetaData/classes/Presentation/UtilitiesInterface.php
@@ -29,4 +29,6 @@ public function getUserDateFormat(): DateFormat;
public function txt(string $key): string;
public function txtFill(string $key, string ...$values): string;
+
+ public function sanitizeForHTML(string $string): string;
}
diff --git a/components/ILIAS/MetaData/classes/Repository/Dictionary/LOMDictionaryInitiator.php b/components/ILIAS/MetaData/classes/Repository/Dictionary/LOMDictionaryInitiator.php
index 25fe914780c9..2ea0e04a5bcf 100755
--- a/components/ILIAS/MetaData/classes/Repository/Dictionary/LOMDictionaryInitiator.php
+++ b/components/ILIAS/MetaData/classes/Repository/Dictionary/LOMDictionaryInitiator.php
@@ -28,7 +28,7 @@
class LOMDictionaryInitiator extends BaseDictionaryInitiator
{
- public const TABLES = [
+ public const array TABLES = [
'annotation' => 'il_meta_annotation',
'classification' => 'il_meta_classification',
'contribute' => 'il_meta_contribute',
@@ -59,7 +59,7 @@ class LOMDictionaryInitiator extends BaseDictionaryInitiator
'context' => 'il_meta_context'
];
- public const ID_NAME = [
+ public const array ID_NAME = [
'annotation' => 'meta_annotation_id',
'classification' => 'meta_classification_id',
'contribute' => 'meta_contribute_id',
diff --git a/components/ILIAS/MetaData/classes/Settings/Copyright/Usage/class.ilMDCopyrightUsageGUI.php b/components/ILIAS/MetaData/classes/Settings/Copyright/Usage/class.ilMDCopyrightUsageGUI.php
index 8a47dacd2028..625817377142 100755
--- a/components/ILIAS/MetaData/classes/Settings/Copyright/Usage/class.ilMDCopyrightUsageGUI.php
+++ b/components/ILIAS/MetaData/classes/Settings/Copyright/Usage/class.ilMDCopyrightUsageGUI.php
@@ -29,7 +29,7 @@
*/
class ilMDCopyrightUsageGUI
{
- public const DEFAULT_CMD = 'showUsageTable';
+ public const string DEFAULT_CMD = 'showUsageTable';
protected EntryInterface $entry;
diff --git a/components/ILIAS/MetaData/classes/Settings/Copyright/class.ilMDCopyrightSelectionEntry.php b/components/ILIAS/MetaData/classes/Settings/Copyright/class.ilMDCopyrightSelectionEntry.php
deleted file mode 100755
index a254890f4337..000000000000
--- a/components/ILIAS/MetaData/classes/Settings/Copyright/class.ilMDCopyrightSelectionEntry.php
+++ /dev/null
@@ -1,359 +0,0 @@
-
- */
-class ilMDCopyrightSelectionEntry
-{
- protected ilLogger $logger;
- protected ilDBInterface $db;
- protected RendererInterface $renderer;
- protected RepositoryInterface $repository;
- protected UIRenderer $ui_renderer;
-
- private int $entry_id;
- private string $title = '';
- private string $description = '';
- private string $copyright = '';
- private int $usage = 0;
-
- protected bool $outdated = false;
-
- protected int $order_position = 0;
-
- public function __construct(int $a_entry_id)
- {
- global $DIC;
-
- $this->renderer = new Renderer(
- $DIC->ui()->factory(),
- $DIC->resourceStorage()
- );
- $this->repository = new DatabaseRepository(new Wrapper($DIC->database()));
- $this->ui_renderer = $DIC->ui()->renderer();
- $this->logger = $DIC->logger()->meta();
- $this->db = $DIC->database();
- $this->entry_id = $a_entry_id;
- $this->read();
- }
-
- /**
- * @return ilMDCopyrightSelectionEntry[]
- */
- public static function _getEntries(): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT entry_id FROM il_md_cpr_selections ORDER BY is_default DESC, position ASC";
- $res = $ilDB->query($query);
-
- $entries = [];
- while ($row = $ilDB->fetchObject($res)) {
- $entries[] = new ilMDCopyrightSelectionEntry((int) $row->entry_id);
- }
- return $entries;
- }
-
- public static function lookupCopyyrightTitle(string $a_cp_string): string
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- if (!$entry_id = self::_extractEntryId($a_cp_string)) {
- return $a_cp_string;
- }
-
- $query = "SELECT title FROM il_md_cpr_selections " .
- "WHERE entry_id = " . $ilDB->quote($entry_id, ilDBConstants::T_INTEGER) . " ";
- $res = $ilDB->query($query);
- $row = $ilDB->fetchObject($res);
- return $row->title ?? '';
- }
-
- public static function _lookupCopyright(string $a_cp_string): string
- {
- global $DIC;
-
- $renderer = new Renderer(
- $DIC->ui()->factory(),
- $DIC->resourceStorage()
- );
- $repository = new DatabaseRepository(new Wrapper($DIC->database()));
- $ui_renderer = $DIC->ui()->renderer();
-
- if (!$entry_id = self::_extractEntryId($a_cp_string)) {
- return $a_cp_string;
- }
-
- $entry = $repository->getEntry($entry_id);
- $components = $renderer->toUIComponents($entry->copyrightData());
-
- return $ui_renderer->render($components);
- }
-
- public static function _lookupCopyrightForExport(string $a_cp_string): string
- {
- global $DIC;
-
- $repository = new DatabaseRepository(new Wrapper($DIC->database()));
-
- if (!$entry_id = self::_extractEntryId($a_cp_string)) {
- return $a_cp_string;
- }
-
- $data = $repository->getEntry($entry_id)->copyrightData();
-
- return (string) ($data->link() ?? $data->fullName());
- }
-
- public static function lookupCopyrightFromImport(string $copyright_text): int
- {
- global $DIC;
-
- $repository = new DatabaseRepository(new Wrapper($DIC->database()));
-
- // url should be made to match regardless of scheme
- $normalized_copyright = str_replace('https://', 'http://', $copyright_text);
-
- $matches_by_name = null;
- foreach ($repository->getAllEntries() as $entry) {
- $entry_link = (string) $entry->copyrightData()->link();
- $normalized_link = str_replace('https://', 'http://', $entry_link);
- if ($normalized_link !== '' && str_contains($normalized_copyright, $normalized_link)) {
- return $entry->id();
- }
-
- if (
- is_null($matches_by_name) &&
- trim($copyright_text) === trim($entry->copyrightData()->fullName())
- ) {
- $matches_by_name = $entry->id();
- }
- }
-
- if (!is_null($matches_by_name)) {
- return $matches_by_name;
- }
- return 0;
- }
-
- public static function _extractEntryId(string $a_cp_string): int
- {
- if (!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string, $matches)) {
- return 0;
- }
- if ($matches[1] != IL_INST_ID) {
- return 0;
- }
- return (int) ($matches[2] ?? 0);
- }
-
- public static function isEntry($a_cp_string): bool
- {
- if (!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string)) {
- return false;
- }
- return true;
- }
-
- public function getUsage(): int
- {
- return $this->usage;
- }
-
- public function getEntryId(): int
- {
- return $this->entry_id;
- }
-
- /**
- * Get if the entry is default
- * No setter for this.
- */
- public function getIsDefault(): bool
- {
- $query = "SELECT is_default FROM il_md_cpr_selections " .
- "WHERE entry_id = " . $this->db->quote($this->entry_id, 'integer');
-
- $res = $this->db->query($query);
- $row = $this->db->fetchAssoc($res);
-
- return (bool) ($row['is_default'] ?? false);
- }
-
- public function setOutdated(bool $a_value): void
- {
- $this->outdated = $a_value;
- }
-
- public function getOutdated(): bool
- {
- return $this->outdated;
- }
-
- public static function getDefault(): int
- {
- global $DIC;
-
- $db = $DIC->database();
-
- $query = "SELECT entry_id FROM il_md_cpr_selections " .
- "WHERE is_default = " . $db->quote(1, 'integer');
-
- $res = $db->query($query);
- $row = $db->fetchAssoc($res);
-
- return (int) $row['entry_id'];
- }
-
- public function setTitle(string $a_title): void
- {
- $this->title = $a_title;
- }
-
- public function getTitle(): string
- {
- return $this->title;
- }
-
- public function setDescription(string $a_desc): void
- {
- $this->description = $a_desc;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setCopyright(string $a_copyright): void
- {
- $this->copyright = $a_copyright;
- }
-
- public function getCopyright(): string
- {
- return $this->copyright;
- }
-
- public function setOrderPosition(int $a_position): void
- {
- $this->order_position = $a_position;
- }
-
- public function getOrderPosition(): int
- {
- return $this->order_position;
- }
-
- protected function getNextOrderPosition(): int
- {
- $query = "SELECT count(entry_id) total FROM il_md_cpr_selections";
- $res = $this->db->query($query);
- $row = $this->db->fetchAssoc($res);
-
- return $row['total'] + 1;
- }
-
- public function add(): bool
- {
- $next_id = $this->db->nextId('il_md_cpr_selections');
-
- $this->db->insert('il_md_cpr_selections', array(
- 'entry_id' => array('integer', $next_id),
- 'title' => array('text', $this->getTitle()),
- 'description' => array('clob', $this->getDescription()),
- //'copyright' => array('clob', $this->getCopyright()),
- 'outdated' => array('integer', $this->getOutdated()),
- 'position' => array('integer', $this->getNextOrderPosition())
- ));
- $this->entry_id = $next_id;
- return true;
- }
-
- public function update(): bool
- {
- $this->db->update('il_md_cpr_selections', array(
- 'title' => array('text', $this->getTitle()),
- 'description' => array('clob', $this->getDescription()),
- //'copyright' => array('clob', $this->getCopyright()),
- 'outdated' => array('integer', $this->getOutdated()),
- 'position' => array('integer', $this->getOrderPosition())
- ), array(
- 'entry_id' => array('integer', $this->getEntryId())
- ));
- return true;
- }
-
- public function delete(): void
- {
- /*$query = "DELETE FROM il_md_cpr_selections " .
- "WHERE entry_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
- $res = $this->db->manipulate($query);*/
- }
-
- public function validate(): bool
- {
- return $this->getTitle() !== '';
- }
-
- private function read(): void
- {
- $entry = $this->repository->getEntry($this->entry_id);
-
- $rendered_cp = $this->ui_renderer->render(
- $this->renderer->toUIComponents($entry->copyrightData())
- );
-
- $this->setTitle($entry->title());
- $this->setDescription($entry->description());
- $this->setCopyright($rendered_cp);
- $this->setOutdated($entry->isOutdated());
- $this->setOrderPosition($entry->position());
-
- $query = "SELECT count(meta_rights_id) used FROM il_meta_rights " .
- "WHERE description = " . $this->db->quote(
- 'il_copyright_entry__' . IL_INST_ID . '__' . $this->getEntryId(),
- 'text'
- );
-
- $res = $this->db->query($query);
- $row = $this->db->fetchObject($res);
- $this->usage = (int) $row->used;
- }
-
- public static function createIdentifier(int $a_entry_id): string
- {
- return 'il_copyright_entry__' . IL_INST_ID . '__' . $a_entry_id;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/Settings/OER/class.ilMDOERSettingsGUI.php b/components/ILIAS/MetaData/classes/Settings/OER/class.ilMDOERSettingsGUI.php
index d3c9343451af..fa6e0f53d53e 100644
--- a/components/ILIAS/MetaData/classes/Settings/OER/class.ilMDOERSettingsGUI.php
+++ b/components/ILIAS/MetaData/classes/Settings/OER/class.ilMDOERSettingsGUI.php
@@ -100,24 +100,35 @@ protected function initSettingsForm(): ilPropertyFormGUI
{
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
- $form->setTitle($this->lng->txt('md_copyright_settings'));
if ($this->access_service->hasCurrentUserWriteAccess()) {
$form->addCommandButton('saveOERSettings', $this->lng->txt('save'));
}
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('md_settings_licence'));
+ $form->addItem($header);
+
$check = new ilCheckboxInputGUI($this->lng->txt('md_copyright_enabled'), 'active');
$check->setChecked($this->MDSettings()->isCopyrightSelectionActive());
$check->setValue('1');
$check->setInfo($this->lng->txt('md_copyright_enable_info'));
$form->addItem($check);
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('md_settings_harvester'));
+ $form->addItem($header);
+
ilAdministrationSettingsFormHandler::addFieldsToForm(
$this->getAdministrationFormId(),
$form,
$this->parent_obj_gui
);
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('md_settings_publishing'));
+ $form->addItem($header);
+
$oai_check = new ilCheckboxInputGUI($this->lng->txt('md_oai_pmh_enabled'), 'oai_active');
$oai_check->setChecked($this->MDSettings()->isOAIPMHActive());
$oai_check->setValue('1');
diff --git a/components/ILIAS/MetaData/classes/Settings/Vocabularies/Presentation.php b/components/ILIAS/MetaData/classes/Settings/Vocabularies/Presentation.php
index ef11f3f0b3dc..6cd741bf7215 100755
--- a/components/ILIAS/MetaData/classes/Settings/Vocabularies/Presentation.php
+++ b/components/ILIAS/MetaData/classes/Settings/Vocabularies/Presentation.php
@@ -156,7 +156,7 @@ public function makeValuesPresentable(
$vocabulary->type() === VocabType::STANDARD ||
$vocabulary->type() === VocabType::COPYRIGHT
) {
- $presentable_values[] = $labelled_value->label();
+ $presentable_values[] = $this->presentation_utils->sanitizeForHTML($labelled_value->label());
continue;
}
@@ -164,7 +164,7 @@ public function makeValuesPresentable(
if ($labelled_value->label() !== '') {
$presentable_value = $labelled_value->label() . ' (' . $presentable_value . ')';
}
- $presentable_values[] = $presentable_value;
+ $presentable_values[] = $this->presentation_utils->sanitizeForHTML($presentable_value);
}
return $presentable_values;
diff --git a/components/ILIAS/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php b/components/ILIAS/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
index b5f7bc76e31a..99d2679e2d3a 100644
--- a/components/ILIAS/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
+++ b/components/ILIAS/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
@@ -36,6 +36,7 @@
use ILIAS\Refinery\Factory as Refinery;
use ILIAS\MetaData\Settings\Vocabularies\DataRetrieval;
use JetBrains\PhpStorm\NoReturn;
+use ILIAS\UICore\GlobalTemplate;
/**
* @ilCtrl_Calls ilMDVocabulariesGUI: ilMDVocabularyUploadHandlerGUI
@@ -276,7 +277,7 @@ protected function deleteVocabulary(): void
);
}
$this->tpl->setOnScreenMessage(
- ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ GlobalTemplate::MESSAGE_TYPE_SUCCESS,
$this->lng->txt('md_vocab_deletion_successful'),
true
);
@@ -289,7 +290,7 @@ protected function activateVocabulary(string $vocab_id): void
$this->vocab_manager->getVocabulary($vocab_id)
);
$this->tpl->setOnScreenMessage(
- ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ GlobalTemplate::MESSAGE_TYPE_SUCCESS,
$this->lng->txt('md_vocab_update_successful'),
true
);
@@ -302,7 +303,7 @@ protected function deactivateVocabulary(string $vocab_id): void
$this->vocab_manager->getVocabulary($vocab_id)
);
$this->tpl->setOnScreenMessage(
- ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ GlobalTemplate::MESSAGE_TYPE_SUCCESS,
$this->lng->txt('md_vocab_update_successful'),
true
);
@@ -315,7 +316,7 @@ protected function allowCustomInputForVocabulary(string $vocab_id): void
$this->vocab_manager->getVocabulary($vocab_id)
);
$this->tpl->setOnScreenMessage(
- ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ GlobalTemplate::MESSAGE_TYPE_SUCCESS,
$this->lng->txt('md_vocab_update_successful'),
true
);
@@ -328,7 +329,7 @@ protected function disallowCustomInputForVocabulary(string $vocab_id): void
$this->vocab_manager->getVocabulary($vocab_id)
);
$this->tpl->setOnScreenMessage(
- ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ GlobalTemplate::MESSAGE_TYPE_SUCCESS,
$this->lng->txt('md_vocab_update_successful'),
true
);
@@ -404,13 +405,13 @@ protected function getTable(): DataTable
)->withAsync(true);
return $this->ui_factory->table()->data(
- $this->lng->txt('md_vocab_table_title'),
- $columns,
new DataRetrieval(
$this->vocab_manager,
$this->presentation,
$this->ui_factory
- )
+ ),
+ $this->lng->txt('md_vocab_table_title'),
+ $columns,
)->withActions($actions)->withRequest($this->http->request());
}
diff --git a/components/ILIAS/MetaData/classes/Settings/class.ilMDSettingsControllerGUI.php b/components/ILIAS/MetaData/classes/Settings/class.ilMDSettingsControllerGUI.php
index 78b2a53e6130..0d1f5a94e923 100644
--- a/components/ILIAS/MetaData/classes/Settings/class.ilMDSettingsControllerGUI.php
+++ b/components/ILIAS/MetaData/classes/Settings/class.ilMDSettingsControllerGUI.php
@@ -104,7 +104,7 @@ protected function setTabs(): void
$this->tabs_gui->addSubTab(
self::OER_SETTINGS_TAB,
- $this->lng->txt('settings'),
+ $this->lng->txt('md_settings'),
$this->ctrl->getLinkTargetByClass(
ilMDOERSettingsGUI::class,
'showOERSettings'
diff --git a/components/ILIAS/MetaData/classes/Setup/DeleteLOMForObjectTypeMigration.php b/components/ILIAS/MetaData/classes/Setup/DeleteLOMForObjectTypeMigration.php
new file mode 100755
index 000000000000..af7908b86aab
--- /dev/null
+++ b/components/ILIAS/MetaData/classes/Setup/DeleteLOMForObjectTypeMigration.php
@@ -0,0 +1,136 @@
+db = $environment->getResource(Environment::RESOURCE_DATABASE);
+
+ $io = $environment->getResource(Environment::RESOURCE_ADMIN_INTERACTION);
+ if ($io instanceof IOWrapper) {
+ $this->io = $io;
+ }
+ }
+
+ final public function step(Environment $environment): void
+ {
+ $selects = [];
+ foreach (LOMDictionaryInitiator::TABLES as $table) {
+ $selects[] = 'SELECT rbac_id, obj_id FROM ' . $this->db->quoteIdentifier($table) .
+ ' WHERE obj_type = ' . $this->quotedObjectType();
+ }
+ if (empty($selects)) {
+ return;
+ }
+ $query = 'SELECT rbac_id, obj_id FROM (' . implode(' UNION ', $selects) .
+ ') AS t ORDER BY t.rbac_id, t.obj_id ASC LIMIT 1';
+ $res = $this->db->query($query);
+ if (!($row = $this->db->fetchAssoc($res))) {
+ $this->logInfo('No LOM found for ' . $this->objectType());
+ return;
+ }
+ $rbac_id = $row['rbac_id'];
+ $obj_id = $row['obj_id'];
+
+ $this->logInfo('Deleting LOM for rbac_id = ' . $rbac_id . ' and obj_id = ' . $obj_id);
+
+ foreach (LOMDictionaryInitiator::TABLES as $table) {
+ $query = 'DELETE FROM ' . $this->db->quoteIdentifier($table) .
+ ' WHERE obj_type = ' . $this->quotedObjectType() .
+ ' AND rbac_id = ' . $this->db->quote($rbac_id, \ilDBConstants::T_INTEGER) .
+ ' AND obj_id = ' . $this->db->quote($obj_id, \ilDBConstants::T_INTEGER);
+ $this->db->manipulate($query);
+ }
+ $this->logSuccess('Done!');
+ }
+
+ final public function getRemainingAmountOfSteps(): int
+ {
+ $selects = [];
+ foreach (LOMDictionaryInitiator::TABLES as $table) {
+ $selects[] = 'SELECT rbac_id, obj_id FROM ' . $this->db->quoteIdentifier($table) .
+ ' WHERE obj_type = ' . $this->quotedObjectType();
+ }
+ if (empty($selects)) {
+ return 0;
+ }
+ $query = 'SELECT COUNT(*) AS count FROM (' . implode(' UNION ', $selects) . ') AS t';
+ $res = $this->db->query($query);
+ if ($row = $this->db->fetchAssoc($res)) {
+ return (int) $row['count'];
+ }
+ return 0;
+ }
+
+ private function quotedObjectType(): string
+ {
+ return $this->db->quote($this->objectType(), \ilDBConstants::T_TEXT);
+ }
+
+ protected function logInfo(string $str): void
+ {
+ if (!isset($this->io) || !$this->io->isVerbose()) {
+ return;
+ }
+ $this->io->inform($str);
+ }
+
+ protected function logSuccess(string $str): void
+ {
+ if (!isset($this->io) || !$this->io->isVerbose()) {
+ return;
+ }
+ $this->io->success($str);
+ }
+}
diff --git a/components/ILIAS/MetaData/classes/Setup/InitLOMForObjectTypeMigration.php b/components/ILIAS/MetaData/classes/Setup/InitLOMForObjectTypeMigration.php
index bad8ab85e9ac..72fca70481e9 100755
--- a/components/ILIAS/MetaData/classes/Setup/InitLOMForObjectTypeMigration.php
+++ b/components/ILIAS/MetaData/classes/Setup/InitLOMForObjectTypeMigration.php
@@ -78,7 +78,7 @@ final public function step(Environment $environment): void
object_description.description AS long_description
FROM object_data
LEFT JOIN object_description ON object_data.obj_id = object_description.obj_id
- LEFT JOIN il_meta_general ON il_meta_general.rbac_id = object_data.obj_id
+ LEFT JOIN il_meta_general ON il_meta_general.rbac_id = object_data.obj_id AND il_meta_general.obj_type = object_data.type
WHERE object_data.type = " . $this->quotedObjectType() . " " .
"AND il_meta_general.rbac_id IS NULL
AND NOT COALESCE(object_data.title, '') = ''
@@ -147,7 +147,7 @@ final public function getRemainingAmountOfSteps(): int
{
$res = $this->db->query(
$query = "SELECT count(*) AS count FROM object_data LEFT JOIN il_meta_general
- ON il_meta_general.rbac_id = object_data.obj_id
+ ON il_meta_general.rbac_id = object_data.obj_id AND il_meta_general.obj_type = object_data.type
WHERE object_data.type = " . $this->quotedObjectType() . " " .
"AND il_meta_general.rbac_id IS NULL
AND NOT COALESCE(object_data.title, '') = ''"
diff --git a/components/ILIAS/MetaData/classes/Vocabularies/Controlled/Repository.php b/components/ILIAS/MetaData/classes/Vocabularies/Controlled/Repository.php
index 6e637dbae079..3c1351d253cb 100644
--- a/components/ILIAS/MetaData/classes/Vocabularies/Controlled/Repository.php
+++ b/components/ILIAS/MetaData/classes/Vocabularies/Controlled/Repository.php
@@ -181,10 +181,17 @@ public function getLabelsForValues(
$this->db->in('value', ...$values)
);
+ $labels_by_value = [];
foreach ($result as $row) {
+ $labels_by_value[(string) $row['value']] = (string) $row['label'];
+ }
+ foreach ($values as $value) {
+ if (!array_key_exists($value, $labels_by_value)) {
+ continue;
+ }
yield new LabelledValue(
- (string) $row['value'],
- (string) $row['label']
+ $value,
+ $labels_by_value[$value]
);
}
}
@@ -276,7 +283,7 @@ protected function readVocabularyValues(string $vocab_id): \Generator
{
$result = $this->db->query(
'SELECT value FROM il_md_vocab_contr_vals WHERE vocab_id = ' .
- $this->db->quoteAsInteger($vocab_id)
+ $this->db->quoteAsInteger($vocab_id) . " ORDER BY COALESCE(NULLIF(label,''), value) ASC"
);
foreach ($result as $row) {
yield (string) $row['value'];
diff --git a/components/ILIAS/MetaData/classes/Vocabularies/Factory/FactoryInterface.php b/components/ILIAS/MetaData/classes/Vocabularies/Factory/FactoryInterface.php
index 2d0ebb3fa0f1..e6c245bc9a88 100755
--- a/components/ILIAS/MetaData/classes/Vocabularies/Factory/FactoryInterface.php
+++ b/components/ILIAS/MetaData/classes/Vocabularies/Factory/FactoryInterface.php
@@ -25,8 +25,8 @@
interface FactoryInterface
{
- public const STANDARD_SOURCE = 'LOMv1.0';
- public const COPYRIGHT_SOURCE = 'ILIAS';
+ public const string STANDARD_SOURCE = 'LOMv1.0';
+ public const string COPYRIGHT_SOURCE = 'ILIAS';
public function standard(SlotIdentifier $slot, string ...$values): BuilderInterface;
diff --git a/components/ILIAS/MetaData/classes/XML/Writer/SimpleDC/SimpleDC.php b/components/ILIAS/MetaData/classes/XML/Writer/SimpleDC/SimpleDC.php
index 9d9cfaeae332..37f6756ed667 100644
--- a/components/ILIAS/MetaData/classes/XML/Writer/SimpleDC/SimpleDC.php
+++ b/components/ILIAS/MetaData/classes/XML/Writer/SimpleDC/SimpleDC.php
@@ -125,6 +125,14 @@ protected function addCreatorsPublishersAndContributorsToXML(\SimpleXMLElement $
->withNextStep('entity')
->get();
+ $path_from_entity_to_role = $this->path_factory
+ ->custom()
+ ->withRelative(true)
+ ->withNextStepToSuperElement()
+ ->withNextStep('role')
+ ->withNextStep('value')
+ ->get();
+
$creators = [];
$creator_navigator = $this->navigator_factory->navigator($creator_path, $set->getRoot());
foreach ($creator_navigator->elementsAtFinalStep() as $creator) {
@@ -156,10 +164,17 @@ protected function addCreatorsPublishersAndContributorsToXML(\SimpleXMLElement $
continue;
}
+ $role = $this->navigator_factory
+ ->navigator($path_from_entity_to_role, $any_contributor)
+ ->lastElementAtFinalStep()?->getData()?->value() ?? '';
+ $contributor = $any_contributor->getData()->value();
+ if ($role !== '') {
+ $contributor .= ' (' . $role . ')';
+ }
$this->addNamespacedChildToXML(
$xml,
'contributor',
- $any_contributor->getData()->value()
+ $contributor
);
}
}
@@ -436,6 +451,8 @@ protected function addNamespacedChildToXML(
if ($value === '') {
return null;
}
- return $xml->addChild($name, $value, "http://purl.org/dc/elements/1.1/");
+ $child_xml = $xml->addChild($name, null, "http://purl.org/dc/elements/1.1/");
+ $child_xml[0] = $value;
+ return $child_xml;
}
}
diff --git a/components/ILIAS/MetaData/classes/XML/Writer/Standard/Standard.php b/components/ILIAS/MetaData/classes/XML/Writer/Standard/Standard.php
index e3bb43cca2f8..e071d7cd720d 100644
--- a/components/ILIAS/MetaData/classes/XML/Writer/Standard/Standard.php
+++ b/components/ILIAS/MetaData/classes/XML/Writer/Standard/Standard.php
@@ -115,7 +115,8 @@ protected function addSubElementsToXML(
continue;
}
- $child_xml = $xml->addChild($sub_name, $sub_value);
+ $child_xml = $xml->addChild($sub_name);
+ $child_xml[0] = $sub_value;
$this->addSubElementsToXML($sub_element, $sub_tag, $child_xml, $depth + 1);
}
}
@@ -141,10 +142,8 @@ protected function addLangStringToXML(
$this->getTagForElement($string_element)
);
}
- $string_xml = $xml->addChild(
- 'string',
- $string_value
- );
+ $string_xml = $xml->addChild('string');
+ $xml->string = $string_value;
if (is_null($language_element)) {
return;
diff --git a/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php b/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
index 35c09d6069cd..d3a247bce8b6 100755
--- a/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
+++ b/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
@@ -94,6 +94,10 @@ public function hasCustomSettings(): bool
public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
{
// target selection
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('meta_oer_categories'));
+ $a_form->addItem($header);
+
$target = new ilRepositorySelector2InputGUI(
$this->lng->txt('meta_oer_target'),
'target',
@@ -136,6 +140,10 @@ public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
$a_form->addItem($ex_target);
// copyright selection
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('meta_oer_harvested_licences'));
+ $a_form->addItem($header);
+
$checkbox_group = new ilCheckboxGroupInputGUI(
$this->lng->txt('meta_oer_copyright_selection'),
'copyright'
@@ -157,6 +165,10 @@ public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
$a_form->addItem($checkbox_group);
// object type selection
+ $header = new ilFormSectionHeaderGUI();
+ $header->setTitle($this->lng->txt('meta_oer_harvested_types'));
+ $a_form->addItem($header);
+
$checkbox_group = new ilCheckboxGroupInputGUI(
$this->lng->txt('meta_oer_object_type_selection'),
'object_type'
diff --git a/components/ILIAS/MetaData/classes/class.ilMD.php b/components/ILIAS/MetaData/classes/class.ilMD.php
deleted file mode 100755
index 215578d8fe74..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMD.php
+++ /dev/null
@@ -1,339 +0,0 @@
-getRBACId(), $this->getObjId())) {
- $gen = new ilMDGeneral();
- $gen->setMetaId($id);
- return $gen;
- }
- return null;
- }
-
- public function addGeneral(): ?ilMDGeneral
- {
- $gen = new ilMDGeneral($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $gen;
- }
-
- public function getLifecycle(): ?ilMDLifecycle
- {
- if ($id = ilMDLifecycle::_getId($this->getRBACId(), $this->getObjId())) {
- $lif = new ilMDLifecycle();
- $lif->setMetaId($id);
-
- return $lif;
- }
- return null;
- }
-
- public function addLifecycle(): ilMDLifecycle
- {
- $lif = new ilMDLifecycle($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $lif;
- }
-
- public function getMetaMetadata(): ?ilMDMetaMetadata
- {
- if ($id = ilMDMetaMetadata::_getId($this->getRBACId(), $this->getObjId())) {
- $met = new ilMDMetaMetadata();
- $met->setMetaId($id);
-
- return $met;
- }
- return null;
- }
-
- public function addMetaMetadata(): ilMDMetaMetadata
- {
- $met = new ilMDMetaMetadata($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $met;
- }
-
- public function getTechnical(): ?ilMDTechnical
- {
- if ($id = ilMDTechnical::_getId($this->getRBACId(), $this->getObjId())) {
- $tec = new ilMDTechnical();
- $tec->setMetaId($id);
-
- return $tec;
- }
- return null;
- }
-
- public function addTechnical(): ilMDTechnical
- {
- $tec = new ilMDTechnical($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $tec;
- }
-
- public function getEducational(): ?ilMDEducational
- {
- if ($id = ilMDEducational::_getId($this->getRBACId(), $this->getObjId())) {
- $edu = new ilMDEducational();
- $edu->setMetaId($id);
-
- return $edu;
- }
- return null;
- }
-
- public function addEducational(): ilMDEducational
- {
- $edu = new ilMDEducational($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $edu;
- }
-
- public function getRights(): ?ilMDRights
- {
- if ($id = ilMDRights::_getId($this->getRBACId(), $this->getObjId())) {
- $rig = new ilMDRights();
- $rig->setMetaId($id);
-
- return $rig;
- }
- return null;
- }
-
- public function addRights(): ilMDRights
- {
- $rig = new ilMDRights($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $rig;
- }
-
- /**
- * @return int[]
- */
- public function getRelationIds(): array
- {
- return ilMDRelation::_getIds($this->getRBACId(), $this->getObjId());
- }
-
- public function getRelation(int $a_relation_id): ?ilMDRelation
- {
- if (!$a_relation_id) {
- return null;
- }
-
- $rel = new ilMDRelation();
- $rel->setMetaId($a_relation_id);
-
- return $rel;
- }
-
- public function addRelation(): ilMDRelation
- {
- $rel = new ilMDRelation($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $rel;
- }
-
- /**
- * @return int[]
- */
- public function getAnnotationIds(): array
- {
- return ilMDAnnotation::_getIds($this->getRBACId(), $this->getObjId());
- }
-
- public function getAnnotation(int $a_annotation_id): ?ilMDAnnotation
- {
- if (!$a_annotation_id) {
- return null;
- }
-
- $ann = new ilMDAnnotation();
- $ann->setMetaId($a_annotation_id);
-
- return $ann;
- }
-
- public function addAnnotation(): ilMDAnnotation
- {
- $ann = new ilMDAnnotation($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $ann;
- }
-
- /**
- * @return int[]
- */
- public function getClassificationIds(): array
- {
- return ilMDClassification::_getIds($this->getRBACId(), $this->getObjId());
- }
-
- public function getClassification(int $a_classification_id): ?ilMDClassification
- {
- if (!$a_classification_id) {
- return null;
- }
-
- $cla = new ilMDClassification();
- $cla->setMetaId($a_classification_id);
-
- return $cla;
- }
-
- public function addClassification(): ilMDClassification
- {
- $cla = new ilMDClassification($this->getRBACId(), $this->getObjId(), $this->getObjType());
-
- return $cla;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('MetaData');
-
- // General
- if (is_object($gen = $this->getGeneral())) {
- $gen->setExportMode($this->getExportMode());
- $gen->toXML($writer);
- } else {
- // Defaults
-
- $gen = new ilMDGeneral(
- $this->getRBACId(),
- $this->getObjId(),
- $this->getObjType()
- ); // added type, alex, 31 Oct 2007
- $gen->setExportMode($this->getExportMode());
- $gen->toXML($writer);
- }
-
- // Lifecycle
- if (is_object($lif = $this->getLifecycle())) {
- $lif->toXML($writer);
- }
-
- // Meta-Metadata
- if (is_object($met = $this->getMetaMetadata())) {
- $met->toXML($writer);
- }
-
- // Technical
- if (is_object($tec = $this->getTechnical())) {
- $tec->toXML($writer);
- }
-
- // Educational
- if (is_object($edu = $this->getEducational())) {
- $edu->toXML($writer);
- }
-
- // Rights
- if (is_object($rig = $this->getRights())) {
- $rig->toXML($writer);
- }
-
- // Relations
- foreach ($this->getRelationIds() as $id) {
- $rel = $this->getRelation($id);
- $rel->toXML($writer);
- }
-
- // Annotations
- foreach ($this->getAnnotationIds() as $id) {
- $ann = $this->getAnnotation($id);
- $ann->toXML($writer);
- }
-
- // Classification
- foreach ($this->getClassificationIds() as $id) {
- $cla = $this->getClassification($id);
- $cla->toXML($writer);
- }
-
- $writer->xmlEndTag('MetaData');
- }
-
- public function cloneMD(int $a_rbac_id, int $a_obj_id, string $a_obj_type): ilMD
- {
- // this method makes an xml export of the original meta data set
- // and uses this xml string to clone the object
- $md2xml = new ilMD2XML($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $md2xml->startExport();
-
- $mdxmlcopier = new ilMDXMLCopier($md2xml->getXML(), $a_rbac_id, $a_obj_id, $a_obj_type);
- $mdxmlcopier->startParsing();
-
- return $mdxmlcopier->getMDObject();
- }
-
- public function deleteAll(): bool
- {
- $tables = [
- 'il_meta_annotation',
- 'il_meta_classification',
- 'il_meta_contribute',
- 'il_meta_description',
- 'il_meta_educational',
- 'il_meta_entity',
- 'il_meta_format',
- 'il_meta_general',
- 'il_meta_identifier',
- 'il_meta_identifier_',
- 'il_meta_keyword',
- 'il_meta_language',
- 'il_meta_lifecycle',
- 'il_meta_location',
- 'il_meta_meta_data',
- 'il_meta_relation',
- 'il_meta_requirement',
- 'il_meta_rights',
- 'il_meta_taxon',
- 'il_meta_taxon_path',
- 'il_meta_technical',
- 'il_meta_tar'
- ];
-
- foreach ($tables as $table) {
- $query = "DELETE FROM " . $table . " " .
- "WHERE rbac_id = " . $this->db->quote($this->getRBACId(), ilDBConstants::T_INTEGER) . " " .
- "AND obj_id = " . $this->db->quote($this->getObjId(), ilDBConstants::T_INTEGER);
-
- $this->db->query($query);
- }
-
- return true;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMD2XML.php b/components/ILIAS/MetaData/classes/class.ilMD2XML.php
deleted file mode 100755
index 869118252a14..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMD2XML.php
+++ /dev/null
@@ -1,64 +0,0 @@
-md_obj = new ilMD($a_rbac_id, $a_obj_id, $a_type);
- parent::__construct();
- }
-
- public function setExportMode(bool $a_export_mode = true): void
- {
- $this->export_mode = $a_export_mode;
- }
-
- public function getExportMode(): bool
- {
- return $this->export_mode;
- }
-
- public function startExport(): void
- {
- // Starts the xml export and calls all element classes
- $this->md_obj->setExportMode($this->getExportMode());
- $this->md_obj->toXML($this);
- }
-
- public function getXML(): string
- {
- return $this->xmlDumpMem(false);
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDAnnotation.php b/components/ILIAS/MetaData/classes/class.ilMDAnnotation.php
deleted file mode 100755
index 359a3cc1f27d..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDAnnotation.php
+++ /dev/null
@@ -1,189 +0,0 @@
-entity = $a_entity;
- }
-
- public function getEntity(): string
- {
- return $this->entity;
- }
-
- public function setDate(string $a_date): void
- {
- $this->date = $a_date;
- }
-
- public function getDate(): string
- {
- return $this->date;
- }
-
- public function setDescription(string $a_desc): void
- {
- $this->description = $a_desc;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setDescriptionLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->description_language = $lng_obj;
- }
-
- public function getDescriptionLanguage(): ilMDLanguageItem
- {
- return $this->description_language;
- }
-
- public function getDescriptionLanguageCode(): string
- {
- if (is_object($this->description_language)) {
- return $this->description_language->getLanguageCode();
- }
- return '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_annotation_id'] = array('integer', $next_id = $this->db->nextId('il_meta_annotation'));
-
- if ($this->db->insert('il_meta_annotation', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_annotation',
- $this->__getFields(),
- array("meta_annotation_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_annotation " .
- "WHERE meta_annotation_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'entity' => array('clob', $this->getEntity()),
- 'a_date' => array('clob', $this->getDate()),
- 'description' => array('clob', $this->getDescription()),
- 'description_language' => array('text', $this->getDescriptionLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_annotation " .
- "WHERE meta_annotation_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type);
- $this->setEntity($row->entity ?? '');
- $this->setDate($row->a_date ?? '');
- $this->setDescription($row->description ?? '');
- $this->description_language = new ilMDLanguageItem($row->description_language ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Annotation');
- $writer->xmlElement('Entity', null, $this->getEntity());
- $writer->xmlElement('Date', null, $this->getDate());
- $writer->xmlElement(
- 'Description',
- array(
- 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
- ),
- $this->getDescription()
- );
- $writer->xmlEndTag('Annotation');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id): array
- {
- global $DIC;
-
- $ilDB = $DIC['ilDB'];
-
- $query = "SELECT meta_annotation_id FROM il_meta_annotation " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_annotation_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDBase.php b/components/ILIAS/MetaData/classes/class.ilMDBase.php
deleted file mode 100755
index ac5bdb6fdf65..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDBase.php
+++ /dev/null
@@ -1,194 +0,0 @@
-__
- */
- private bool $export_mode = false;
-
- protected ilLogger $log;
- protected ilDBInterface $db;
-
- /**
- * constructor
- *
- * @param int $a_rbac_id object id (NOT ref_id!) of rbac object (e.g for page objects
- * the obj_id of the content object; for media objects this
- * is set to 0, because their object id are not assigned to ref ids)
- * @param int $a_obj_id object id (e.g for structure objects the obj_id of the structure object)
- * @param string $a_type type of the object (e.g st,pg,crs ...)
- */
- public function __construct(
- int $a_rbac_id = 0,
- int $a_obj_id = 0,
- string $a_type = ''
- ) {
- global $DIC;
-
- $this->db = $DIC->database();
-
- if ($a_obj_id === 0) {
- $a_obj_id = $a_rbac_id;
- }
-
- $this->log = ilLoggerFactory::getLogger("meta");
-
- $this->rbac_id = $a_rbac_id;
- $this->obj_id = $a_obj_id;
- $this->obj_type = $a_type;
- }
-
- abstract public function read(): bool;
-
- // SET/GET
- public function setRBACId(int $a_id): void
- {
- $this->rbac_id = $a_id;
- }
-
- public function getRBACId(): int
- {
- return $this->rbac_id;
- }
-
- public function setObjId(int $a_id): void
- {
- $this->obj_id = $a_id;
- }
-
- public function getObjId(): int
- {
- return $this->obj_id;
- }
-
- public function setObjType(string $a_type): void
- {
- $this->obj_type = $a_type;
- }
-
- public function getObjType(): string
- {
- return $this->obj_type;
- }
-
- public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
- {
- $this->meta_id = $a_meta_id;
-
- if ($a_read_data) {
- $this->read();
- }
- }
-
- public function getMetaId(): ?int
- {
- return $this->meta_id;
- }
-
- public function setParentType(string $a_parent_type): void
- {
- $this->parent_type = $a_parent_type;
- }
-
- public function getParentType(): string
- {
- return $this->parent_type;
- }
-
- public function setParentId(int $a_id): void
- {
- $this->parent_id = $a_id;
- }
-
- public function getParentId(): int
- {
- return $this->parent_id;
- }
-
- public function setExportMode(bool $a_export_mode = true): void
- {
- $this->export_mode = $a_export_mode;
- }
-
- public function getExportMode(): bool
- {
- return $this->export_mode;
- }
-
- public function validate(): bool
- {
- return false;
- }
-
- public function update(): bool
- {
- return false;
- }
-
- public function save(): int
- {
- return 0;
- }
-
- public function delete(): bool
- {
- return false;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDClassification.php b/components/ILIAS/MetaData/classes/class.ilMDClassification.php
deleted file mode 100755
index e63d493bf57b..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDClassification.php
+++ /dev/null
@@ -1,306 +0,0 @@
- 'Discipline',
- 'idea' => 'Idea',
- 'prerequisite' => 'Prerequisite',
- 'educational objective' => 'EducationalObjective',
- 'accessibility restrictions' => 'AccessibilityRestrictions',
- 'educational level' => 'EducationalLevel',
- 'skill level' => 'SkillLevel',
- 'security level' => 'SecurityLevel',
- 'competency' => 'Competency'
- ];
-
- private string $purpose = '';
- private string $description = '';
- private ?ilMDLanguageItem $description_language = null;
-
- // METHODS OF CLIENT OBJECTS (TaxonPath, Keyword)
-
- /**
- * @return int[]
- */
- public function getTaxonPathIds(): array
- {
- return ilMDTaxonPath::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_classification');
- }
-
- public function getTaxonPath(int $a_taxon_path_id): ?ilMDTaxonPath
- {
- if (!$a_taxon_path_id) {
- return null;
- }
- $tax = new ilMDTaxonPath();
- $tax->setMetaId($a_taxon_path_id);
-
- return $tax;
- }
-
- public function addTaxonPath(): ilMDTaxonPath
- {
- $tax = new ilMDTaxonPath($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $tax->setParentId($this->getMetaId());
- $tax->setParentType('meta_classification');
-
- return $tax;
- }
-
- public function getKeywordIds(): ?array
- {
- return ilMDKeyword::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_classification');
- }
-
- public function getKeyword(int $a_keyword_id): ?ilMDKeyword
- {
- if (!$a_keyword_id) {
- return null;
- }
- $key = new ilMDKeyword();
- $key->setMetaId($a_keyword_id);
-
- return $key;
- }
-
- public function addKeyword(): ilMDKeyword
- {
- $key = new ilMDKeyword($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $key->setParentId($this->getMetaId());
- $key->setParentType('meta_classification');
-
- return $key;
- }
-
- // SET/GET
- public function setPurpose(string $a_purpose): bool
- {
- switch ($a_purpose) {
- case 'Discipline':
- case 'Idea':
- case 'Prerequisite':
- case 'EducationalObjective':
- case 'AccessibilityRestrictions':
- case 'EducationalLevel':
- case 'SkillLevel':
- case 'SecurityLevel':
- case 'Competency':
- $this->purpose = $a_purpose;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getPurpose(): string
- {
- return $this->purpose;
- }
-
- public function setDescription(string $a_description): void
- {
- $this->description = $a_description;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setDescriptionLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->description_language = $lng_obj;
- }
-
- public function getDescriptionLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->description_language) ? $this->description_language : null;
- }
-
- public function getDescriptionLanguageCode(): string
- {
- return is_object($this->description_language) ? $this->description_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_classification_id'] = array('integer', $next_id = $this->db->nextId('il_meta_classification'));
-
- if ($this->db->insert('il_meta_classification', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_classification',
- $this->__getFields(),
- ["meta_classification_id" => ['integer', $this->getMetaId()]]
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_classification " .
- "WHERE meta_classification_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- foreach ($this->getTaxonPathIds() as $id) {
- $tax = $this->getTaxonPath($id);
- $tax->delete();
- }
- foreach ($this->getKeywordIds() as $id) {
- $key = $this->getKeyword($id);
- $key->delete();
- }
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $purpose = (string) array_search(
- $this->getPurpose(),
- self::PURPOSE_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'purpose' => array('text', $purpose),
- 'description' => array('text', $this->getDescription()),
- 'description_language' => array('text', $this->getDescriptionLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_classification " .
- "WHERE meta_classification_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->purpose ?? '', self::PURPOSE_TRANSLATION)) {
- $row->purpose = self::PURPOSE_TRANSLATION[$row->purpose ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type);
- $this->setPurpose($row->purpose ?? '');
- $this->setDescription($row->description ?? '');
- $this->description_language = new ilMDLanguageItem($row->description_language ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Classification', array(
- 'Purpose' => $this->getPurpose() ?: 'Idea'
- ));
-
- // Taxon Path
- $taxs = $this->getTaxonPathIds();
- foreach ($taxs as $id) {
- $tax = $this->getTaxonPath($id);
- $tax->toXML($writer);
- }
- if (!count($taxs)) {
- $tax = new ilMDTaxonPath($this->getRBACId(), $this->getObjId());
- $tax->toXML($writer);
- }
-
- // Description
- $writer->xmlElement(
- 'Description',
- array(
- 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
- ),
- $this->getDescription()
- );
-
- // Keyword
- $keys = $this->getKeywordIds();
- foreach ($keys as $id) {
- $key = $this->getKeyword($id);
- $key->toXML($writer);
- }
- if (!count($keys)) {
- $key = new ilMDKeyword($this->getRBACId(), $this->getObjId());
- $key->toXML($writer);
- }
- $writer->xmlEndTag('Classification');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id): array
- {
- global $DIC;
-
- $ilDB = $DIC['ilDB'];
-
- $query = "SELECT meta_classification_id FROM il_meta_classification " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_classification_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDContribute.php b/components/ILIAS/MetaData/classes/class.ilMDContribute.php
deleted file mode 100755
index b2440f6b6c2d..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDContribute.php
+++ /dev/null
@@ -1,285 +0,0 @@
-
- * @package ilias-core
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDContribute extends ilMDBase
-{
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private const ROLE_TRANSLATION = [
- 'author' => 'Author',
- 'publisher' => 'Publisher',
- 'unknown' => 'Unknown',
- 'initiator' => 'Initiator',
- 'terminator' => 'Terminator',
- 'editor' => 'Editor',
- 'graphical designer' => 'GraphicalDesigner',
- 'technical implementer' => 'TechnicalImplementer',
- 'content provider' => 'ContentProvider',
- 'technical validator' => 'TechnicalValidator',
- 'educational validator' => 'EducationalValidator',
- 'script writer' => 'ScriptWriter',
- 'instructional designer' => 'InstructionalDesigner',
- 'subject matter expert' => 'SubjectMatterExpert',
- 'creator' => 'Creator',
- 'validator' => 'Validator'
- ];
-
- // Subelements
- private string $date = '';
- private string $role = '';
-
- /**
- * @return int[]
- */
- public function getEntityIds(): array
- {
- return ilMDEntity::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_contribute');
- }
-
- public function getEntity(int $a_entity_id): ?ilMDEntity
- {
- if (!$a_entity_id) {
- return null;
- }
- $ent = new ilMDEntity();
- $ent->setMetaId($a_entity_id);
-
- return $ent;
- }
-
- public function addEntity(): ilMDEntity
- {
- $ent = new ilMDEntity($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $ent->setParentId($this->getMetaId());
- $ent->setParentType('meta_contribute');
-
- return $ent;
- }
-
- // SET/GET
- public function setRole(string $a_role): bool
- {
- switch ($a_role) {
- case 'Author':
- case 'Publisher':
- case 'Unknown':
- case 'Initiator':
- case 'Terminator':
- case 'Editor':
- case 'GraphicalDesigner':
- case 'TechnicalImplementer':
- case 'ContentProvider':
- case 'TechnicalValidator':
- case 'EducationalValidator':
- case 'ScriptWriter':
- case 'InstructionalDesigner':
- case 'SubjectMatterExpert':
- case 'Creator':
- case 'Validator':
- case 'PointOfContact':
- $this->role = $a_role;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getRole(): string
- {
- return $this->role;
- }
-
- public function setDate(string $a_date): void
- {
- $this->date = $a_date;
- }
-
- public function getDate(): string
- {
- return $this->date;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_contribute_id'] = array('integer', $next_id = $this->db->nextId('il_meta_contribute'));
-
- if ($this->db->insert('il_meta_contribute', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_contribute',
- $this->__getFields(),
- array("meta_contribute_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_contribute " .
- "WHERE meta_contribute_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- foreach ($this->getEntityIds() as $id) {
- $ent = $this->getEntity($id);
- $ent->delete();
- }
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $role = (string) array_search(
- $this->getRole(),
- self::ROLE_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'role' => array('text', $role),
- 'c_date' => array('text', $this->getDate())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_contribute " .
- "WHERE meta_contribute_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->role ?? '', self::ROLE_TRANSLATION)) {
- $row->role = self::ROLE_TRANSLATION[$row->role ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type ?? '');
- $this->setRole($row->role ?? '');
- $this->setDate($row->c_date ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Contribute', array(
- 'Role' => $this->getRole() ?: 'Author'
- ));
-
- // Entities
- $entities = $this->getEntityIds();
- foreach ($entities as $id) {
- $ent = $this->getEntity($id);
- $ent->toXML($writer);
- }
- if (!count($entities)) {
- $ent = new ilMDEntity($this->getRBACId(), $this->getObjId());
- $ent->toXML($writer);
- }
-
- $writer->xmlElement('Date', null, $this->getDate());
- $writer->xmlEndTag('Contribute');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC['ilDB'];
-
- $query = "SELECT meta_contribute_id FROM il_meta_contribute " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_contribute_id;
- }
- return $ids;
- }
-
- /**
- * @return string[]
- */
- public static function _lookupAuthors(int $a_rbac_id, int $a_obj_id, string $a_obj_type): array
- {
- global $DIC;
-
- $ilDB = $DIC['ilDB'];
-
- // Ask for 'author' later to use indexes
- $authors = [];
- $query = "SELECT entity,ent.parent_type,role FROM il_meta_entity ent " .
- "JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id " .
- "WHERE ent.rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND ent.obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- if ($row->role === 'Author' && $row->parent_type === 'meta_contribute') {
- $authors[] = trim($row->entity);
- }
- }
- return $authors;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDCreator.php b/components/ILIAS/MetaData/classes/class.ilMDCreator.php
deleted file mode 100755
index 11be25c48e8d..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDCreator.php
+++ /dev/null
@@ -1,227 +0,0 @@
-
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDCreator
-{
- protected ilMD $md_obj;
-
- /*
- * rbac_id ref_id of rbac object (e.g for page objects the obj_id of the content object)
- */
- private int $rbac_id;
-
- /*
- * obj_id (e.g for structure objects the obj_id of the structure object)
- */
- private int $obj_id;
-
- /*
- * type of the object (e.g st,pg,crs ...)
- */
- public string $obj_type;
-
- private string $structure = '';
- private string $catalog = '';
- private string $entry = '';
- private string $keyword = '';
- private string $title = '';
- private string $description = '';
- private string $title_lng = '';
-
- public function __construct(int $a_rbac_id, int $a_obj_id, string $a_type)
- {
- if ($a_obj_id === 0) {
- $a_obj_id = $a_rbac_id;
- }
-
- $this->rbac_id = $a_rbac_id;
- $this->obj_id = $a_obj_id;
- $this->obj_type = $a_type;
-
- $this->md_obj = new ilMD($a_rbac_id, $a_obj_id, $a_type);
- }
-
- // SET/GET
- public function setTitle(string $a_title): void
- {
- $this->title = $a_title;
- }
-
- public function getTitle(): string
- {
- return $this->title;
- }
-
- public function setDescription(string $a_desc): void
- {
- $this->description = $a_desc;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setTitleLanguage(string $a_lng): void
- {
- $this->title_lng = $a_lng;
- }
-
- public function getTitleLanguage(): ilMDLanguageItem
- {
- return new ilMDLanguageItem($this->title_lng);
- }
-
- public function setDescriptionLanguage(string $a_lng): void
- {
- $this->title_lng = $a_lng;
- }
-
- public function getDescriptionLanguage(): ilMDLanguageItem
- {
- return new ilMDLanguageItem($this->title_lng);
- }
-
- public function setLanguage(string $a_lng): void
- {
- $this->title_lng = $a_lng;
- }
-
- public function getLanguage(): ilMDLanguageItem
- {
- return new ilMDLanguageItem($this->title_lng);
- }
-
- public function setKeyword(string $a_key): void
- {
- $this->keyword = $a_key;
- }
-
- public function getKeyword(): string
- {
- return $this->keyword;
- }
-
- public function getRBACId(): int
- {
- return $this->rbac_id;
- }
-
- public function getObjId(): int
- {
- return $this->obj_id;
- }
-
- public function getObjType(): string
- {
- return $this->obj_type;
- }
-
- public function setKeywordLanguage(string $a_lng): void
- {
- $this->title_lng = $a_lng;
- }
-
- public function getKeywordLanguage(): ilMDLanguageItem
- {
- return new ilMDLanguageItem($this->title_lng);
- }
-
- public function setCatalog(string $a_cat): void
- {
- $this->catalog = $a_cat;
- }
-
- public function getCatalog(): string
- {
- return $this->catalog ?: 'ILIAS';
- }
-
- public function setEntry(string $a_entry): void
- {
- $this->entry = $a_entry;
- }
-
- public function getEntry(): string
- {
- return $this->entry ?: 'il__' . $this->getObjType() . '_' . $this->getObjId();
- }
-
- public function setStructure(string $a_structure): void
- {
- $this->structure = $a_structure;
- }
-
- public function getStructure(): string
- {
- return $this->structure ?: 'Hierarchical';
- }
-
- public function create(): void
- {
- $this->__createGeneral();
- }
-
- // PROTECTED
- public function __createGeneral(): bool
- {
- $md_gen = $this->md_obj->addGeneral();
-
- $md_gen->setStructure($this->getStructure());
- $md_gen->setTitle($this->getTitle());
- $md_gen->setTitleLanguage($this->getTitleLanguage());
- $md_gen->save();
-
- $md_ide = $md_gen->addIdentifier();
- $md_ide->setCatalog($this->getCatalog());
- $md_ide->setEntry($this->getEntry());
- $md_ide->save();
-
- $md_lng = $md_gen->addLanguage();
- $md_lng->setLanguage($this->getLanguage());
- $md_lng->save();
-
- $md_des = $md_gen->addDescription();
- $md_des->setDescription($this->getDescription());
- $md_des->setDescriptionLanguage($this->getDescriptionLanguage());
- $md_des->save();
-
- $md_key = $md_gen->addKeyword();
- $md_key->setKeyword($this->getKeyword());
- $md_key->setKeywordLanguage($this->getKeywordLanguage());
- $md_key->save();
-
- return true;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDDescription.php b/components/ILIAS/MetaData/classes/class.ilMDDescription.php
deleted file mode 100755
index b22960a16190..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDDescription.php
+++ /dev/null
@@ -1,163 +0,0 @@
-description = $a_description;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setDescriptionLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->description_language = $lng_obj;
- }
-
- public function getDescriptionLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->description_language) ? $this->description_language : null;
- }
-
- public function getDescriptionLanguageCode(): string
- {
- return is_object($this->description_language) ? $this->description_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_description_id'] = array('integer', $next_id = $this->db->nextId('il_meta_description'));
-
- if ($this->db->insert('il_meta_description', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_description',
- $this->__getFields(),
- array("meta_description_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_description " .
- "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'description' => array('clob', $this->getDescription()),
- 'description_language' => array('text', $this->getDescriptionLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_description " .
- "WHERE meta_description_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type ?? '');
- $this->setDescription($row->description ?? '');
- $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language ?? ''));
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement(
- 'Description',
- array(
- 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
- ),
- $this->getDescription()
- );
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_description_id FROM il_meta_description " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, ilDBConstants::T_INTEGER) . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, ilDBConstants::T_INTEGER) . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, ilDBConstants::T_INTEGER) . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, ilDBConstants::T_INTEGER) . " " .
- "ORDER BY meta_description_id";
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_description_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDEducational.php b/components/ILIAS/MetaData/classes/class.ilMDEducational.php
deleted file mode 100755
index 57220e662335..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDEducational.php
+++ /dev/null
@@ -1,898 +0,0 @@
- 'Active',
- 'expositive' => 'Expositive',
- 'mixed' => 'Mixed'
- ];
-
- private const LEARNING_RESOURCE_TYPE_TRANSLATION = [
- 'exercise' => 'Exercise',
- 'simulation' => 'Simulation',
- 'questionnaire' => 'Questionnaire',
- 'diagram' => 'Diagram',
- 'figure' => 'Figure',
- 'graph' => 'Graph',
- 'index' => 'Index',
- 'slide' => 'Slide',
- 'table' => 'Table',
- 'narrative text' => 'NarrativeText',
- 'exam' => 'Exam',
- 'experiment' => 'Experiment',
- 'problem statement' => 'ProblemStatement',
- 'self assessment' => 'SelfAssessment',
- 'lecture' => 'Lecture'
- ];
-
- private const INTERACTIVITY_LEVEL_TRANSLATION = [
- 'very low' => 'VeryLow',
- 'low' => 'Low',
- 'medium' => 'Medium',
- 'high' => 'High',
- 'very high' => 'VeryHigh'
- ];
-
- private const SEMANTIC_DENSITY_TRANSLATION = [
- 'very low' => 'VeryLow',
- 'low' => 'Low',
- 'medium' => 'Medium',
- 'high' => 'High',
- 'very high' => 'VeryHigh'
- ];
-
- private const INTENDED_END_USER_ROLE_TRANSLATION = [
- 'teacher' => 'Teacher',
- 'author' => 'Author',
- 'learner' => 'Learner',
- 'manager' => 'Manager'
- ];
-
- private const CONTEXT_TRANSLATION = [
- 'school' => 'School',
- 'higher education' => 'HigherEducation',
- 'training' => 'Training',
- 'other' => 'Other'
- ];
-
- private const DIFFICULTY_TRANSLATION = [
- 'very easy' => 'VeryEasy',
- 'easy' => 'Easy',
- 'medium' => 'Medium',
- 'difficult' => 'Difficult',
- 'very difficult' => 'VeryDifficult'
- ];
-
- private string $interactivity_type = '';
- private string $learning_resource_type = '';
- private string $interactivity_level = '';
- private string $semantic_density = '';
- private string $intended_end_user_role = '';
- private string $context = '';
- private string $difficulty = '';
- private string $typical_learning_time = '';
-
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private int $learning_resource_type_id = 0;
- private int $intended_end_user_role_id = 0;
- private int $context_id = 0;
-
- /**
- * @return int[]
- */
- public function getTypicalAgeRangeIds(): array
- {
- return ilMDTypicalAgeRange::_getIds(
- $this->getRBACId(),
- $this->getObjId(),
- $this->getMetaId(),
- 'meta_educational'
- );
- }
-
- public function getTypicalAgeRange(int $a_typical_age_range_id): ?ilMDTypicalAgeRange
- {
- if (!$a_typical_age_range_id) {
- return null;
- }
- $typ = new ilMDTypicalAgeRange();
- $typ->setMetaId($a_typical_age_range_id);
-
- return $typ;
- }
-
- public function addTypicalAgeRange(): ilMDTypicalAgeRange
- {
- $typ = new ilMDTypicalAgeRange($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $typ->setParentId($this->getMetaId());
- $typ->setParentType('meta_educational');
-
- return $typ;
- }
-
- /**
- * @return int[]
- */
- public function getDescriptionIds(): array
- {
- return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_educational');
- }
-
- public function getDescription(int $a_description_id): ?ilMDDescription
- {
- if (!$a_description_id) {
- return null;
- }
- $des = new ilMDDescription();
- $des->setMetaId($a_description_id);
-
- return $des;
- }
-
- public function addDescription(): ilMDDescription
- {
- $des = new ilMDDescription($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $des->setParentId($this->getMetaId());
- $des->setParentType('meta_educational');
-
- return $des;
- }
-
- /**
- * @return int[]
- */
- public function getLanguageIds(): array
- {
- return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_educational');
- }
-
- public function getLanguage(int $a_language_id): ?ilMDLanguage
- {
- if (!$a_language_id) {
- return null;
- }
- $lan = new ilMDLanguage();
- $lan->setMetaId($a_language_id);
-
- return $lan;
- }
-
- public function addLanguage(): ilMDLanguage
- {
- $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $lan->setParentId($this->getMetaId());
- $lan->setParentType('meta_educational');
-
- return $lan;
- }
-
- // SET/GET
- public function setInteractivityType(string $a_iat): bool
- {
- switch ($a_iat) {
- case 'Active':
- case 'Expositive':
- case 'Mixed':
- $this->interactivity_type = $a_iat;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getInteractivityType(): string
- {
- return $this->interactivity_type;
- }
-
- public function setLearningResourceType(string $a_lrt): bool
- {
- switch ($a_lrt) {
- case 'Exercise':
- case 'Simulation':
- case 'Questionnaire':
- case 'Diagram':
- case 'Figure':
- case 'Graph':
- case 'Index':
- case 'Slide':
- case 'Table':
- case 'NarrativeText':
- case 'Exam':
- case 'Experiment':
- case 'ProblemStatement':
- case 'SelfAssessment':
- case 'Lecture':
- $this->learning_resource_type = $a_lrt;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getLearningResourceType(): string
- {
- return $this->learning_resource_type;
- }
-
- public function setInteractivityLevel(string $a_iat): bool
- {
- switch ($a_iat) {
- case 'VeryLow':
- case 'Low':
- case 'Medium':
- case 'High':
- case 'VeryHigh':
- $this->interactivity_level = $a_iat;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getInteractivityLevel(): string
- {
- return $this->interactivity_level;
- }
-
- public function setSemanticDensity(string $a_sd): bool
- {
- switch ($a_sd) {
- case 'VeryLow':
- case 'Low':
- case 'Medium':
- case 'High':
- case 'VeryHigh':
- $this->semantic_density = $a_sd;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getSemanticDensity(): string
- {
- return $this->semantic_density;
- }
-
- public function setIntendedEndUserRole(string $a_ieur): bool
- {
- switch ($a_ieur) {
- case 'Teacher':
- case 'Author':
- case 'Learner':
- case 'Manager':
- $this->intended_end_user_role = $a_ieur;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getIntendedEndUserRole(): string
- {
- return $this->intended_end_user_role;
- }
-
- public function setContext(string $a_context): bool
- {
- switch ($a_context) {
- case 'School':
- case 'HigherEducation':
- case 'Training':
- case 'Other':
- $this->context = $a_context;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getContext(): string
- {
- return $this->context;
- }
-
- public function setDifficulty(string $a_difficulty): bool
- {
- switch ($a_difficulty) {
- case 'VeryEasy':
- case 'Easy':
- case 'Medium':
- case 'Difficult':
- case 'VeryDifficult':
- $this->difficulty = $a_difficulty;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getDifficulty(): string
- {
- return $this->difficulty;
- }
-
- public function setPhysicalTypicalLearningTime(
- int $months,
- int $days,
- int $hours,
- int $minutes,
- int $seconds
- ): bool {
- if (!$months && !$days && !$hours && !$minutes && !$seconds) {
- $this->setTypicalLearningTime('PT00H00M');
- return true;
- }
- $tlt = 'P';
- if ($months) {
- $tlt .= ($months . 'M');
- }
- if ($days) {
- $tlt .= ($days . 'D');
- }
- if ($hours || $minutes || $seconds) {
- $tlt .= 'T';
- }
- if ($hours) {
- $tlt .= ($hours . 'H');
- }
- if ($minutes) {
- $tlt .= ($minutes . 'M');
- }
- if ($seconds) {
- $tlt .= ($seconds . 'S');
- }
- $this->setTypicalLearningTime($tlt);
- return true;
- }
-
- public function setTypicalLearningTime(string $a_tlt): void
- {
- $this->typical_learning_time = $a_tlt;
- }
-
- public function getTypicalLearningTime(): string
- {
- return $this->typical_learning_time;
- }
-
- public function getTypicalLearningTimeSeconds(): int
- {
- $time_arr = ilMDUtils::_LOMDurationToArray($this->getTypicalLearningTime());
- if ($time_arr === []) {
- return 0;
- }
- return 60 * 60 * 24 * 30 * $time_arr[0] + 60 * 60 * 24 * $time_arr[1] + 60 * 60 * $time_arr[2] + 60 * $time_arr[3] + $time_arr[4];
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_educational_id'] = array('integer', $next_id = $this->db->nextId('il_meta_educational'));
-
- if ($this->db->insert('il_meta_educational', $fields)) {
- $this->setMetaId($next_id);
- $this->createOrUpdateLearningResourceType();
- $this->createOrUpdateIntendedEndUserRole();
- $this->createOrUpdateContext();
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- if (!$this->getMetaId()) {
- return false;
- }
-
- $this->createOrUpdateLearningResourceType();
- $this->createOrUpdateIntendedEndUserRole();
- $this->createOrUpdateContext();
-
- return (bool) $this->db->update(
- 'il_meta_educational',
- $this->__getFields(),
- array("meta_educational_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_educational " .
- "WHERE meta_educational_id = " . $this->db->quote($this->getMetaId(), ilDBConstants::T_INTEGER);
- $res = $this->db->manipulate($query);
-
- $this->deleteAllLearningResourceTypes();
- $this->deleteAllIntendedEndUserRoles();
- $this->deleteAllContexts();
-
- foreach ($this->getTypicalAgeRangeIds() as $id) {
- $typ = $this->getTypicalAgeRange($id);
- $typ->delete();
- }
- foreach ($this->getDescriptionIds() as $id) {
- $des = $this->getDescription($id);
- $des->delete();
- }
- foreach ($this->getLanguageIds() as $id) {
- $lan = $this->getLanguage($id);
- $lan->delete();
- }
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $interactivity_type = (string) array_search(
- $this->getInteractivityType(),
- self::INTERACTIVITY_TYPE_TRANSLATION
- );
- $interactivity_level = (string) array_search(
- $this->getInteractivityLevel(),
- self::INTERACTIVITY_LEVEL_TRANSLATION
- );
- $semantic_density = (string) array_search(
- $this->getSemanticDensity(),
- self::SEMANTIC_DENSITY_TRANSLATION
- );
- $difficulty = (string) array_search(
- $this->getDifficulty(),
- self::DIFFICULTY_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'interactivity_type' => array('text', $interactivity_type),
- //'learning_resource_type' => array('text', $this->getLearningResourceType()),
- 'interactivity_level' => array('text', $interactivity_level),
- 'semantic_density' => array('text', $semantic_density),
- //'intended_end_user_role' => array('text', $this->getIntendedEndUserRole()),
- //'context' => array('text', $this->getContext()),
- 'difficulty' => array('text', $difficulty),
- 'typical_learning_time' => array('text', $this->getTypicalLearningTime())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_educational " .
- "WHERE meta_educational_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->interactivity_type ?? '', self::INTERACTIVITY_TYPE_TRANSLATION)) {
- $row->interactivity_type = self::INTERACTIVITY_TYPE_TRANSLATION[$row->interactivity_type ?? ''];
- }
- if (key_exists($row->interactivity_level ?? '', self::INTERACTIVITY_LEVEL_TRANSLATION)) {
- $row->interactivity_level = self::INTERACTIVITY_LEVEL_TRANSLATION[$row->interactivity_level ?? ''];
- }
- if (key_exists($row->semantic_density ?? '', self::SEMANTIC_DENSITY_TRANSLATION)) {
- $row->semantic_density = self::SEMANTIC_DENSITY_TRANSLATION[$row->semantic_density ?? ''];
- }
- if (key_exists($row->difficulty ?? '', self::DIFFICULTY_TRANSLATION)) {
- $row->difficulty = self::DIFFICULTY_TRANSLATION[$row->difficulty ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setInteractivityType($row->interactivity_type ?? '');
- //$this->setLearningResourceType($row->learning_resource_type ?? '');
- $this->setInteractivityLevel($row->interactivity_level ?? '');
- $this->setSemanticDensity($row->semantic_density ?? '');
- //$this->setIntendedEndUserRole($row->intended_end_user_role ?? '');
- //$this->setContext($row->context ?? '');
- $this->setDifficulty($row->difficulty ?? '');
- $this->setTypicalLearningTime($row->typical_learning_time ?? '');
- }
-
- $this->readFirstLearningResourceType();
- $this->readFirstIntendedEndUserRole();
- $this->readFirstContext();
- return true;
- }
- return false;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag(
- 'Educational',
- array(
- 'InteractivityType' => $this->getInteractivityType() ?: 'Active',
- 'LearningResourceType' => $this->getLearningResourceType() ?: 'Exercise',
- 'InteractivityLevel' => $this->getInteractivityLevel() ?: 'Medium',
- 'SemanticDensity' => $this->getSemanticDensity() ?: 'Medium',
- 'IntendedEndUserRole' => $this->getIntendedEndUserRole() ?: 'Learner',
- 'Context' => $this->getContext() ?: 'Other',
- 'Difficulty' => $this->getDifficulty() ?: 'Medium'
- )
- );
-
- // TypicalAgeRange
- $typ_ages = $this->getTypicalAgeRangeIds();
- foreach ($typ_ages as $id) {
- $key = $this->getTypicalAgeRange($id);
-
- // extra test due to bug 5316 (may be due to eLaix import)
- if (is_object($key)) {
- $key->toXML($writer);
- }
- }
- if (!count($typ_ages)) {
- $typ = new ilMDTypicalAgeRange($this->getRBACId(), $this->getObjId());
- $typ->toXML($writer);
- }
-
- // TypicalLearningTime
- $writer->xmlElement('TypicalLearningTime', null, $this->getTypicalLearningTime());
-
- // Description
- foreach ($this->getDescriptionIds() as $id) {
- $key = $this->getDescription($id);
- $key->toXML($writer);
- }
- // Language
- foreach ($this->getLanguageIds() as $id) {
- $lang = $this->getLanguage($id);
- $lang->toXML($writer);
- }
- $writer->xmlEndTag('Educational');
- }
-
- // STATIC
- public static function _getId(int $a_rbac_id, int $a_obj_id): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_educational_id FROM il_meta_educational " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- return (int) $row->meta_educational_id;
- }
- return 0;
- }
-
- public static function _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id = 0): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $a_obj_id = $a_obj_id ?: $a_rbac_id;
-
- $query = "SELECT typical_learning_time FROM il_meta_educational " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $time_arr = ilMDUtils::_LOMDurationToArray((string) $row->typical_learning_time);
- if (!count($time_arr)) {
- return 0;
- }
- return 60 * 60 * 24 * 30 * $time_arr[0] +
- 60 * 60 * 24 * $time_arr[1] +
- 60 * 60 * $time_arr[2] +
- 60 * $time_arr[3] +
- $time_arr[4];
- }
- return 0;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateLearningResourceType(): void
- {
- $learning_resource_type = (string) array_search(
- $this->getLearningResourceType(),
- self::LEARNING_RESOURCE_TYPE_TRANSLATION
- );
-
- $this->learning_resource_type_id = $this->createOrUpdateInNewTable(
- 'il_meta_lr_type',
- 'meta_lr_type_id',
- $this->getLearningResourceTypeId(),
- 'learning_resource_type',
- $learning_resource_type
- );
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateIntendedEndUserRole(): void
- {
- $intended_end_user_role = (string) array_search(
- $this->getIntendedEndUserRole(),
- self::INTENDED_END_USER_ROLE_TRANSLATION
- );
-
- $this->intended_end_user_role_id = $this->createOrUpdateInNewTable(
- 'il_meta_end_usr_role',
- 'meta_end_usr_role_id',
- $this->getIntendedEndUserRoleId(),
- 'intended_end_user_role',
- $intended_end_user_role
- );
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateContext(): void
- {
- $context = (string) array_search(
- $this->getContext(),
- self::CONTEXT_TRANSLATION
- );
-
- $this->context_id = $this->createOrUpdateInNewTable(
- 'il_meta_context',
- 'meta_context_id',
- $this->getContextId(),
- 'context',
- $context
- );
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateInNewTable(
- string $table,
- string $id_field,
- int $id,
- string $data_field,
- string $data_value
- ): int {
- if ($data_value === '') {
- return 0;
- }
-
- if (!$id) {
- $this->db->insert(
- $table,
- [
- $id_field => ['integer', $next_id = $this->db->nextId($table)],
- 'rbac_id' => ['integer', $this->getRBACId()],
- 'obj_id' => ['integer', $this->getObjId()],
- 'obj_type' => ['text', $this->getObjType()],
- 'parent_type' => ['text', 'meta_educational'],
- 'parent_id' => ['integer', $this->getMetaId()],
- $data_field => ['text', $data_value]
- ]
- );
- return $next_id;
- }
-
- $this->db->update(
- $table,
- [$data_field => ['text', $data_value]],
- [$id_field => ['integer', $id]]
- );
- return $id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstLearningResourceType(): void
- {
- $query = "SELECT * FROM il_meta_lr_type WHERE meta_lr_type_id = " .
- $this->db->quote($this->getLearningResourceTypeId(), 'integer');
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- if (key_exists($row['learning_resource_type'], self::LEARNING_RESOURCE_TYPE_TRANSLATION)) {
- $row['learning_resource_type'] = self::LEARNING_RESOURCE_TYPE_TRANSLATION[$row['learning_resource_type']];
- }
- $this->setLearningResourceType((string) $row['learning_resource_type']);
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstIntendedEndUserRole(): void
- {
- $query = "SELECT * FROM il_meta_end_usr_role WHERE meta_end_usr_role_id = " .
- $this->db->quote($this->getIntendedEndUserRoleId(), 'integer');
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- if (key_exists($row['intended_end_user_role'], self::INTENDED_END_USER_ROLE_TRANSLATION)) {
- $row['intended_end_user_role'] = self::INTENDED_END_USER_ROLE_TRANSLATION[$row['intended_end_user_role']];
- }
- $this->setIntendedEndUserRole((string) $row['intended_end_user_role']);
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstContext(): void
- {
- $query = "SELECT * FROM il_meta_context WHERE meta_context_id = " .
- $this->db->quote($this->getContextId(), 'integer');
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- if (key_exists($row['context'], self::CONTEXT_TRANSLATION)) {
- $row['context'] = self::CONTEXT_TRANSLATION[$row['context']];
- }
- $this->setContext((string) $row['context']);
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllLearningResourceTypes(): void
- {
- $query = "DELETE FROM il_meta_lr_type WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllIntendedEndUserRoles(): void
- {
- $query = "DELETE FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllContexts(): void
- {
- $query = "DELETE FROM il_meta_context WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getLearningResourceTypeId(): int
- {
- return $this->learning_resource_type_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getIntendedEndUserRoleId(): int
- {
- return $this->intended_end_user_role_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getContextId(): int
- {
- return $this->context_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readLearningResourceTypeId(int $parent_id): void
- {
- $query = "SELECT meta_lr_type_id FROM il_meta_lr_type WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_lr_type_id";
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->learning_resource_type_id = (int) $row['meta_lr_type_id'];
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readIntendedEndUserRoleId(int $parent_id): void
- {
- $query = "SELECT meta_end_usr_role_id FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_end_usr_role_id";
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->intended_end_user_role_id = (int) $row['meta_end_usr_role_id'];
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readContextId(int $parent_id): void
- {
- $query = "SELECT meta_context_id FROM il_meta_context WHERE parent_type = 'meta_educational'
- AND parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_context_id";
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->context_id = (int) $row['meta_context_id'];
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
- {
- $this->readLearningResourceTypeId($a_meta_id);
- $this->readIntendedEndUserRoleId($a_meta_id);
- $this->readContextId($a_meta_id);
- parent::setMetaId($a_meta_id, $a_read_data);
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDEntity.php b/components/ILIAS/MetaData/classes/class.ilMDEntity.php
deleted file mode 100755
index aedb0f35e3c5..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDEntity.php
+++ /dev/null
@@ -1,142 +0,0 @@
-
- * @package ilias-core
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDEntity extends ilMDBase
-{
- private string $entity = '';
-
- // SET/GET
- public function setEntity(string $a_entity): void
- {
- $this->entity = $a_entity;
- }
-
- public function getEntity(): string
- {
- return $this->entity;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_entity_id'] = array('integer', $next_id = $this->db->nextId('il_meta_entity'));
-
- if ($this->db->insert('il_meta_entity', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_entity',
- $this->__getFields(),
- array("meta_entity_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_entity " .
- "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- $this->db->query($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'entity' => array('text', $this->getEntity())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_entity " .
- "WHERE meta_entity_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type ?? '');
- $this->setEntity($row->entity ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement('Entity', null, $this->getEntity());
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_entity_id FROM il_meta_entity " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
- "ORDER BY meta_entity_id ";
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_entity_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDFormat.php b/components/ILIAS/MetaData/classes/class.ilMDFormat.php
deleted file mode 100755
index d4dbbe318872..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDFormat.php
+++ /dev/null
@@ -1,135 +0,0 @@
-
- * @package ilias-core
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDFormat extends ilMDBase
-{
- private string $format = '';
-
- // SET/_GET
- public function setFormat(string $a_format): void
- {
- $this->format = $a_format;
- }
-
- public function getFormat(): string
- {
- return $this->format;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_format_id'] = array('integer', $next_id = $this->db->nextId('il_meta_format'));
-
- if ($this->db->insert('il_meta_format', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_format',
- $this->__getFields(),
- array("meta_format_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_format " .
- "WHERE meta_format_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'format' => array('text', $this->getFormat())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_format " .
- "WHERE meta_format_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type);
- $this->setFormat($row->format ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- if ($this->getFormat()) {
- $writer->xmlElement('Format', null, $this->getFormat());
- }
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_format_id FROM il_meta_format " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_format_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDGeneral.php b/components/ILIAS/MetaData/classes/class.ilMDGeneral.php
deleted file mode 100755
index bb74bfeaec70..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDGeneral.php
+++ /dev/null
@@ -1,571 +0,0 @@
-
- * @package ilias-core
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDGeneral extends ilMDBase
-{
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private const STRUCTURE_TRANSLATION = [
- 'atomic' => 'Atomic',
- 'collection' => 'Collection',
- 'networked' => 'Networked',
- 'hierarchical' => 'Hierarchical',
- 'linear' => 'Linear'
- ];
-
- protected ?ilMDLanguageItem $coverage_language = null;
-
- private string $coverage = '';
- private string $structure = '';
- private string $title = '';
- private ?ilMDLanguageItem $title_language = null;
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private int $coverage_id = 0;
-
- /**
- * @return array
- */
- public function getPossibleSubelements(): array
- {
- $subs['Keyword'] = 'meta_keyword';
- $subs['Language'] = 'meta_language';
- $subs['Identifier'] = 'meta_identifier';
- $subs['Description'] = 'meta_description';
-
- return $subs;
- }
-
- // Subelements (Identifier, Language, Description, Keyword)
-
- /**
- * @return int[]
- */
- public function getIdentifierIds(): array
- {
- return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
- }
-
- public function getIdentifier(int $a_identifier_id): ?ilMDIdentifier
- {
- if (!$a_identifier_id) {
- return null;
- }
- $ide = new ilMDIdentifier();
- $ide->setMetaId($a_identifier_id);
-
- return $ide;
- }
-
- public function addIdentifier(): ilMDIdentifier
- {
- $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $ide->setParentId($this->getMetaId());
- $ide->setParentType('meta_general');
-
- return $ide;
- }
-
- /**
- * @return int[]
- */
- public function getLanguageIds(): array
- {
- return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
- }
-
- public function getLanguage(int $a_language_id): ?ilMDLanguage
- {
- if (!$a_language_id) {
- return null;
- }
- $lan = new ilMDLanguage();
- $lan->setMetaId($a_language_id);
-
- return $lan;
- }
-
- public function addLanguage(): ilMDLanguage
- {
- $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $lan->setParentId($this->getMetaId());
- $lan->setParentType('meta_general');
-
- return $lan;
- }
-
- /**
- * @return int[]
- */
- public function getDescriptionIds(): array
- {
- return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
- }
-
- public function getDescription(int $a_description_id): ?ilMDDescription
- {
- if (!$a_description_id) {
- return null;
- }
- $des = new ilMDDescription();
- $des->setMetaId($a_description_id);
-
- return $des;
- }
-
- public function addDescription(): ilMDDescription
- {
- $des = new ilMDDescription($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $des->setParentId($this->getMetaId());
- $des->setParentType('meta_general');
-
- return $des;
- }
-
- /**
- * @return int[]
- */
- public function getKeywordIds(): array
- {
- return ilMDKeyword::_getIds($this->getRBACId(), $this->getObjId(), (int) $this->getMetaId(), 'meta_general');
- }
-
- public function getKeyword(int $a_keyword_id): ?ilMDKeyword
- {
- if (!$a_keyword_id) {
- return null;
- }
- $key = new ilMDKeyword();
- $key->setMetaId($a_keyword_id);
-
- return $key;
- }
-
- public function addKeyword(): ilMDKeyword
- {
- $key = new ilMDKeyword($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $key->setParentId($this->getMetaId());
- $key->setParentType('meta_general');
-
- return $key;
- }
-
- // SET/GET
- public function setStructure(string $a_structure): bool
- {
- switch ($a_structure) {
- case 'Atomic':
- case 'Collection':
- case 'Networked':
- case 'Hierarchical':
- case 'Linear':
- $this->structure = $a_structure;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getStructure(): string
- {
- return $this->structure;
- }
-
- public function setTitle(string $a_title): void
- {
- $this->title = $a_title;
- }
-
- public function getTitle(): string
- {
- return $this->title;
- }
-
- public function setTitleLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->title_language = $lng_obj;
- }
-
- public function getTitleLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->title_language) ? $this->title_language : null;
- }
-
- public function getTitleLanguageCode(): string
- {
- return is_object($this->title_language) ? $this->title_language->getLanguageCode() : '';
- }
-
- public function setCoverage(string $a_coverage): void
- {
- $this->coverage = $a_coverage;
- }
-
- public function getCoverage(): string
- {
- return $this->coverage;
- }
-
- public function setCoverageLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->coverage_language = $lng_obj;
- }
-
- public function getCoverageLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->coverage_language) ? $this->coverage_language : null;
- }
-
- public function getCoverageLanguageCode(): string
- {
- return is_object($this->coverage_language) ? $this->coverage_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_general_id'] = array('integer', $next_id = $this->db->nextId('il_meta_general'));
-
- $this->log->debug("Insert General " . print_r($fields, true));
- $this->log->logStack(ilLogLevel::DEBUG);
- //ilUtil::printBacktrace(10);
-
- if ($this->db->insert('il_meta_general', $fields)) {
- $this->setMetaId($next_id);
- $this->createOrUpdateCoverage();
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- if (!$this->getMetaId()) {
- return false;
- }
-
- $this->createOrUpdateCoverage();
-
- return (bool) $this->db->update(
- 'il_meta_general',
- $this->__getFields(),
- array("meta_general_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if (!$this->getMetaId()) {
- return false;
- }
- // Identifier
- foreach ($this->getIdentifierIds() as $id) {
- $ide = $this->getIdentifier($id);
- $ide->delete();
- }
-
- // Language
- foreach ($this->getLanguageIds() as $id) {
- $lan = $this->getLanguage($id);
- $lan->delete();
- }
-
- // Description
- foreach ($this->getDescriptionIds() as $id) {
- $des = $this->getDescription($id);
- $des->delete();
- }
-
- // Keyword
- foreach ($this->getKeywordIds() as $id) {
- $key = $this->getKeyword($id);
- $key->delete();
- }
-
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_general " .
- "WHERE meta_general_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- $this->deleteAllCoverages();
- return true;
- }
-
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $structure = (string) array_search(
- $this->getStructure(),
- self::STRUCTURE_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'general_structure' => array('text', $structure),
- 'title' => array('text', $this->getTitle()),
- 'title_language' => array('text', $this->getTitleLanguageCode()),
- //'coverage' => array('text', $this->getCoverage()),
- //'coverage_language' => array('text', $this->getCoverageLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_general " .
- "WHERE meta_general_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->general_structure ?? '', self::STRUCTURE_TRANSLATION)) {
- $row->general_structure = self::STRUCTURE_TRANSLATION[$row->general_structure ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType((string) $row->obj_type);
- $this->setStructure((string) $row->general_structure);
- $this->setTitle((string) $row->title);
- $this->setTitleLanguage(new ilMDLanguageItem($row->title_language ?? ''));
- //$this->setCoverage((string) $row->coverage);
- //$this->setCoverageLanguage(new ilMDLanguageItem($row->coverage_language ?? ''));
- }
-
- $this->readFirstCoverage();
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('General', array(
- 'Structure' => $this->getStructure() ?: 'Atomic'
- ));
-
- // Identifier
- $first = true;
- $identifiers = $this->getIdentifierIds();
- foreach ($identifiers as $id) {
- $ide = $this->getIdentifier($id);
- $ide->setExportMode($this->getExportMode());
- $ide->toXML($writer);
- $first = false;
- }
- if (!count($identifiers)) {
- $ide = new ilMDIdentifier(
- $this->getRBACId(),
- $this->getObjId(),
- $this->getObjType()
- ); // added type, alex, 31 Oct 2007
- $ide->setExportMode(true);
- $ide->toXML($writer);
- }
-
- // Title
- $writer->xmlElement(
- 'Title',
- array(
- 'Language' => $this->getTitleLanguageCode() ?: 'en'
- ),
- $this->getTitle()
- );
-
- // Language
- $languages = $this->getLanguageIds();
- foreach ($languages as $id) {
- $lan = $this->getLanguage($id);
- $lan->toXML($writer);
- }
-
- // Description
- $descriptions = $this->getDescriptionIds();
- foreach ($descriptions as $id) {
- $des = $this->getDescription($id);
- $des->toXML($writer);
- }
- if (!count($descriptions)) {
- // Default
-
- $des = new ilMDDescription($this->getRBACId(), $this->getObjId());
- $des->toXML($writer);
- }
-
- // Keyword
- $keywords = $this->getKeywordIds();
- foreach ($keywords as $id) {
- $key = $this->getKeyword($id);
- $key->toXML($writer);
- }
- if (!count($keywords)) {
- // Default
-
- $key = new ilMDKeyword($this->getRBACId(), $this->getObjId());
- $key->toXML($writer);
- }
-
- // Copverage
- if ($this->getCoverage() !== '') {
- $writer->xmlElement(
- 'Coverage',
- array(
- 'Language' => $this->getCoverageLanguageCode() ?: 'en'
- ),
- $this->getCoverage()
- );
- }
- $writer->xmlEndTag('General');
- }
-
- // STATIC
- public static function _getId(int $a_rbac_id, int $a_obj_id): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_general_id FROM il_meta_general " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- return (int) $row->meta_general_id;
- }
- return 0;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateCoverage(): void
- {
- if ($this->getCoverage() === '' && $this->getCoverageLanguageCode() === '') {
- return;
- }
-
- if (!$this->getCoverageId()) {
- $this->db->insert(
- 'il_meta_coverage',
- [
- 'meta_coverage_id' => ['integer', $next_id = $this->db->nextId('il_meta_coverage')],
- 'rbac_id' => ['integer', $this->getRBACId()],
- 'obj_id' => ['integer', $this->getObjId()],
- 'obj_type' => ['text', $this->getObjType()],
- 'parent_type' => ['text', 'meta_general'],
- 'parent_id' => ['integer', $this->getMetaId()],
- 'coverage' => ['text', $this->getCoverage()],
- 'coverage_language' => ['text', $this->getCoverageLanguageCode()]
- ]
- );
- $this->coverage_id = $next_id;
- return;
- }
-
- $this->db->update(
- 'il_meta_coverage',
- [
- 'coverage' => ['text', $this->getCoverage()],
- 'coverage_language' => ['text', $this->getCoverageLanguageCode()]
- ],
- ['meta_coverage_id' => ['integer', $this->getCoverageId()]]
- );
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllCoverages(): void
- {
- $query = "DELETE FROM il_meta_coverage WHERE parent_type = 'meta_general'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstCoverage(): void
- {
- $query = "SELECT * FROM il_meta_coverage WHERE meta_coverage_id = " .
- $this->db->quote($this->getCoverageId(), 'integer');
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->setCoverage((string) $row['coverage']);
- $this->setCoverageLanguage(new ilMDLanguageItem((string) $row['coverage_language']));
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getCoverageId(): int
- {
- return $this->coverage_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readCoverageId(int $parent_id): void
- {
- $query = "SELECT meta_coverage_id FROM il_meta_coverage WHERE parent_type = 'meta_general'
- AND parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_coverage_id";
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->coverage_id = (int) $row['meta_coverage_id'];
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
- {
- $this->readCoverageId($a_meta_id);
- parent::setMetaId($a_meta_id, $a_read_data);
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDIdentifier.php b/components/ILIAS/MetaData/classes/class.ilMDIdentifier.php
deleted file mode 100755
index 8f3ed533c6ec..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDIdentifier.php
+++ /dev/null
@@ -1,269 +0,0 @@
-catalog = $a_catalog;
- }
-
- public function getCatalog(): string
- {
- return $this->catalog;
- }
-
- public function setEntry(string $a_entry): void
- {
- $this->entry = $a_entry;
- }
-
- public function getEntry(): string
- {
- return $this->entry;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_identifier_id'] = array('integer', $next_id = $this->db->nextId('il_meta_identifier'));
-
- if ($this->db->insert('il_meta_identifier', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_identifier',
- $this->__getFields(),
- array("meta_identifier_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_identifier " .
- "WHERE meta_identifier_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'catalog' => array('text', $this->getCatalog()),
- 'entry' => array('text', $this->getEntry())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_identifier " .
- "WHERE meta_identifier_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type);
- $this->setCatalog($row->catalog ?? '');
- $this->setEntry($row->entry ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $entry_default = ($this->getObjId() === 0)
- ? "il_" . IL_INST_ID . "_" . $this->getObjType() . "_" . $this->getRBACId()
- : "il_" . IL_INST_ID . "_" . $this->getObjType() . "_" . $this->getObjId();
-
- $entry = $this->getEntry() ?: $entry_default;
- $catalog = $this->getCatalog();
-
- if ($this->getExportMode() && $this->getCatalog() !== "ILIAS_NID") {
- $entry = $entry_default;
- $catalog = "ILIAS";
- }
-
- if ($catalog !== '') {
- $writer->xmlElement('Identifier', array(
- 'Catalog' => $catalog,
- 'Entry' => $entry
- ));
- } else {
- $writer->xmlElement('Identifier', array('Entry' => $entry));
- }
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_identifier_id FROM il_meta_identifier " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_identifier_id;
- }
- return $ids;
- }
-
- /**
- * @return array>
- */
- public static function _getEntriesForObj(int $a_rbac_id, int $a_obj_id, string $a_obj_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_identifier_id, catalog, entry FROM il_meta_identifier " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND obj_type = " . $ilDB->quote($a_obj_type, 'text');
-
- $res = $ilDB->query($query);
- $entries = array();
- while ($r = $ilDB->fetchAssoc($res)) {
- $entries[$r["meta_identifier_id"]] =
- array(
- "catalog" => $r["catalog"],
- "entry" => $r["entry"]
- );
- }
- return $entries;
- }
-
- /**
- * @return array>
- */
- public static function _getEntriesForRbacObj(int $a_rbac_id, string $a_obj_type = ""): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_identifier_id, catalog, entry, obj_id FROM il_meta_identifier " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer');
-
- if ($a_obj_type !== "") {
- $query .=
- " AND obj_type = " . $ilDB->quote($a_obj_type, 'text');
- }
-
- $res = $ilDB->query($query);
- $entries = array();
- while ($r = $ilDB->fetchAssoc($res)) {
- $entries[$r["meta_identifier_id"]] =
- array(
- "catalog" => $r["catalog"],
- "entry" => $r["entry"],
- "obj_id" => $r["obj_id"]
- );
- }
- return $entries;
- }
-
- public static function existsIdInRbacObject(
- int $a_rbac_id,
- string $a_obj_type,
- string $a_catalog,
- string $a_entry
- ): bool {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_identifier_id, obj_id FROM il_meta_identifier " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') .
- " AND obj_type = " . $ilDB->quote($a_obj_type, 'text') .
- " AND catalog = " . $ilDB->quote($a_catalog, 'text') .
- " AND entry = " . $ilDB->quote($a_entry, 'text');
- $s = $ilDB->query($query);
- if ($r = $ilDB->fetchAssoc($s)) {
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public static function readIdData(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT * FROM il_meta_identifier " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') .
- " AND obj_type = " . $ilDB->quote($a_obj_type, 'text') .
- " AND catalog = " . $ilDB->quote($a_catalog, 'text') .
- " AND entry = " . $ilDB->quote($a_entry, 'text');
- $s = $ilDB->query($query);
- $data = array();
- while ($r = $ilDB->fetchAssoc($s)) {
- $data[] = $r;
- }
- return $data;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDIdentifier_.php b/components/ILIAS/MetaData/classes/class.ilMDIdentifier_.php
deleted file mode 100755
index ac0d4a5c79e0..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDIdentifier_.php
+++ /dev/null
@@ -1,153 +0,0 @@
-catalog = $a_catalog;
- }
-
- public function getCatalog(): string
- {
- return $this->catalog;
- }
-
- public function setEntry(string $a_entry): void
- {
- $this->entry = $a_entry;
- }
-
- public function getEntry(): string
- {
- return $this->entry;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_identifier__id'] = array('integer', $next_id = $this->db->nextId('il_meta_identifier_'));
-
- if ($this->db->insert('il_meta_identifier_', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_identifier_',
- $this->__getFields(),
- array("meta_identifier__id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_identifier_ " .
- "WHERE meta_identifier__id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'catalog' => array('text', $this->getCatalog()),
- 'entry' => array('text', $this->getEntry())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_identifier_ " .
- "WHERE meta_identifier__id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type);
- $this->setCatalog($row->catalog ?? '');
- $this->setEntry($row->entry ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement('Identifier_', array(
- 'Catalog' => $this->getCatalog(),
- 'Entry' => $this->getEntry() ?: "ID1"
- ));
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_identifier__id FROM il_meta_identifier_ " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_identifier__id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDKeyword.php b/components/ILIAS/MetaData/classes/class.ilMDKeyword.php
deleted file mode 100755
index 2e4fe94d59b5..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDKeyword.php
+++ /dev/null
@@ -1,325 +0,0 @@
-keyword = $a_keyword;
- }
-
- public function getKeyword(): string
- {
- return $this->keyword;
- }
-
- public function setKeywordLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->keyword_language = $lng_obj;
- }
-
- public function getKeywordLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->keyword_language) ? $this->keyword_language : null;
- }
-
- public function getKeywordLanguageCode(): string
- {
- return is_object($this->keyword_language) ? $this->keyword_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_keyword_id'] = array('integer', $next_id = $this->db->nextId('il_meta_keyword'));
-
- if ($this->db->insert('il_meta_keyword', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_keyword',
- $this->__getFields(),
- array("meta_keyword_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_keyword " .
- "WHERE meta_keyword_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'keyword' => array('text', $this->getKeyword()),
- 'keyword_language' => array('text', $this->getKeywordLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_keyword " .
- "WHERE meta_keyword_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type ?? '');
- $this->setKeyword($row->keyword ?? '');
- $this->setKeywordLanguage(new ilMDLanguageItem($row->keyword_language ?? ''));
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement(
- 'Keyword',
- array(
- 'Language' => $this->getKeywordLanguageCode() ?: 'en'
- ),
- $this->getKeyword()
- );
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_keyword_id FROM il_meta_keyword " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
- "ORDER BY meta_keyword_id ";
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_keyword_id;
- }
- return $ids;
- }
-
- /**
- * @return array
- */
- public static function _getKeywordsByLanguage(int $a_rbac_id, int $a_obj_id, string $a_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
- $ilObjDataCache = $DIC['ilObjDataCache'];
-
- $query = "SELECT keyword,keyword_language " .
- "FROM il_meta_keyword " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND obj_type = " . $ilDB->quote($a_type, 'text') . " ";
- $res = $ilDB->query($query);
- $keywords = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- if ($row->keyword) {
- $keywords[$row->keyword_language][] = $row->keyword;
- }
- }
- return $keywords;
- }
-
- /**
- * @return array
- */
- public static function _getKeywordsByLanguageAsString(int $a_rbac_id, int $a_obj_id, string $a_type): array
- {
- $key_string = [];
- foreach (self::_getKeywordsByLanguage($a_rbac_id, $a_obj_id, $a_type) as $lng_code => $keywords) {
- $key_string[$lng_code] = implode(",", $keywords);
- }
- return $key_string;
- }
-
- /**
- * @return int[]
- */
- public static function _searchKeywords(string $a_query, string $a_type, int $a_rbac_id = 0): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $qs = 'AND ';
- $counter = 0;
- foreach ((array) explode(' ', $a_query) as $part) {
- if ($counter++) {
- $qs .= 'OR ';
- }
- $qs .= ($ilDB->like('keyword', 'text', $part) . ' ');
- }
-
- if ($a_rbac_id) {
- $query = "SELECT obj_id FROM il_meta_keyword " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
- 'AND obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
- $qs;
- } else {
- $query = "SELECT obj_id FROM il_meta_keyword " .
- 'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
- $qs;
- }
-
- $res = $ilDB->query($query);
- $obj_ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $obj_ids[] = $row->obj_id;
- }
-
- return $obj_ids;
- }
-
- /**
- * @return string[]
- */
- public static function _getMatchingKeywords(string $a_query, string $a_type, int $a_rbac_id = 0): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT DISTINCT keyword FROM il_meta_keyword " .
- 'WHERE obj_type = ' . $ilDB->quote($a_type, 'text') . ' ' .
- 'AND ' . $ilDB->like('keyword', 'text', '%' . trim($a_query) . '%') . ' ';
-
- if ($a_rbac_id) {
- $query .= "AND rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ';
- }
-
- $res = $ilDB->query($query);
- $kws = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $kws[] = $row->keyword;
- }
- return $kws;
- }
-
- public static function lookupKeywords(int $a_rbac_id, int $a_obj_id, bool $a_return_ids = false): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT * FROM il_meta_keyword " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . ' ' .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . ' ';
- $res = $ilDB->query($query);
- $kws = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- if (!$a_return_ids) {
- if (is_string($row->keyword) && $row->keyword !== '') {
- $kws[] = $row->keyword;
- }
- } else {
- $kws[] = $row->meta_keyword_id;
- }
- }
- return $kws;
- }
-
- public static function updateKeywords(ilMDGeneral $a_md_section, array $a_keywords): void
- {
- // trim keywords
- $new_keywords = array();
- foreach ($a_keywords as $lang => $keywords) {
- foreach ((array) $keywords as $keyword) {
- $keyword = trim($keyword);
- if ($keyword !== "" && !(isset($new_keywords[$lang]) && in_array($keyword, $new_keywords[$lang], true))) {
- $new_keywords[$lang][] = $keyword;
- }
- }
- }
-
- // update existing author entries (delete if not entered)
- foreach ($ids = $a_md_section->getKeywordIds() as $id) {
- $md_key = $a_md_section->getKeyword($id);
- $lang = $md_key->getKeywordLanguageCode();
-
- // entered keyword already exists
- if (is_array($new_keywords[$lang] ?? false) && in_array($md_key->getKeyword(), $new_keywords[$lang], true)) {
- unset($new_keywords[$lang][array_search($md_key->getKeyword(), $new_keywords[$lang], true)]);
- } else { // existing keyword has not been entered again -> delete
- $md_key->delete();
- }
- }
-
- // insert entered, but not existing keywords
- foreach ($new_keywords as $lang => $key_arr) {
- foreach ($key_arr as $keyword) {
- if ($keyword !== "") {
- $md_key = $a_md_section->addKeyword();
- $md_key->setKeyword(ilUtil::stripSlashes($keyword));
- $md_key->setKeywordLanguage(new ilMDLanguageItem($lang));
- $md_key->save();
- }
- }
- }
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDLanguage.php b/components/ILIAS/MetaData/classes/class.ilMDLanguage.php
deleted file mode 100755
index 79fabe5434a0..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDLanguage.php
+++ /dev/null
@@ -1,169 +0,0 @@
-database();
-
- $lang = '';
- $query = "SELECT language FROM il_meta_language " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
- "AND parent_type = 'meta_general' " .
- "ORDER BY meta_language_id ";
- $ilDB->setLimit(1, 0);
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $lang = $row->language;
- }
- return $lang;
- }
-
- // SET/GET
- public function setLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->language = $lng_obj;
- }
-
- public function getLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->language) ? $this->language : null;
- }
-
- public function getLanguageCode(): string
- {
- return is_object($this->language) ? $this->language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_language_id'] = array('integer', $next_id = $this->db->nextId('il_meta_language'));
- if ($this->db->insert('il_meta_language', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_language',
- $this->__getFields(),
- array("meta_language_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_language " .
- "WHERE meta_language_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'language' => array('text', $this->getLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_language " .
- "WHERE meta_language_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type);
- $this->setLanguage(new ilMDLanguageItem($row->language ?? ''));
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement(
- 'Language',
- array(
- 'Language' => $this->getLanguageCode() ?: 'en'
- ),
- $this->getLanguage()
- );
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_language_id FROM il_meta_language " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_language_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDLanguageElement.php b/components/ILIAS/MetaData/classes/class.ilMDLanguageElement.php
deleted file mode 100755
index 88dbdbbaac49..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDLanguageElement.php
+++ /dev/null
@@ -1,191 +0,0 @@
-language_code = $a_code;
-
- $this->possible_language_codes = array(
- "aa",
- "ab",
- "af",
- "am",
- "ar",
- "as",
- "ay",
- "az",
- "ba",
- "be",
- "bg",
- "bh",
- "bi",
- "bn",
- "bo",
- "br",
- "ca",
- "co",
- "cs",
- "cy",
- "da",
- "de",
- "dz",
- "el",
- "en",
- "eo",
- "es",
- "et",
- "eu",
- "fa",
- "fi",
- "fj",
- "fo",
- "fr",
- "fy",
- "ga",
- "gd",
- "gl",
- "gn",
- "gu",
- "ha",
- "he",
- "hi",
- "hr",
- "hu",
- "hy",
- "ia",
- "ie",
- "ik",
- "id",
- "is",
- "it",
- "iu",
- "ja",
- "jv",
- "ka",
- "kk",
- "kl",
- "km",
- "kn",
- "ko",
- "ks",
- "ku",
- "ky",
- "la",
- "ln",
- "lo",
- "lt",
- "lv",
- "mg",
- "mi",
- "mk",
- "ml",
- "mn",
- "mo",
- "mr",
- "ms",
- "mt",
- "my",
- "na",
- "ne",
- "nl",
- "no",
- "oc",
- "om",
- "or",
- "pa",
- "pl",
- "ps",
- "pt",
- "qu",
- "rm",
- "rn",
- "ro",
- "ru",
- "rw",
- "sa",
- "sd",
- "sg",
- "sh",
- "si",
- "sk",
- "sl",
- "sm",
- "sn",
- "so",
- "sq",
- "sr",
- "ss",
- "st",
- "su",
- "sv",
- "sw",
- "ta",
- "te",
- "tg",
- "th",
- "ti",
- "tk",
- "tl",
- "tn",
- "to",
- "tr",
- "ts",
- "tt",
- "tw",
- "ug",
- "uk",
- "ur",
- "uz",
- "vi",
- "vo",
- "wo",
- "xh",
- "yi",
- "yo",
- "za",
- "zh",
- "zu"
- );
- }
-
- public function getLanguageCode(): string
- {
- if (in_array($this->language_code, $this->possible_language_codes, true)) {
- return $this->language_code;
- }
- return '';
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDLanguageItem.php b/components/ILIAS/MetaData/classes/class.ilMDLanguageItem.php
deleted file mode 100755
index 14badb0ed6b3..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDLanguageItem.php
+++ /dev/null
@@ -1,216 +0,0 @@
-language_code = $a_code;
- }
-
- public function getLanguageCode(): string
- {
- $lang = self::_getPossibleLanguageCodes();
- if (in_array($this->language_code, $lang)) {
- return $this->language_code;
- }
- return '';
- }
-
- /**
- * @return string[]
- */
- public static function _getPossibleLanguageCodes(): array
- {
- return array(
- "aa",
- "ab",
- "af",
- "am",
- "ar",
- "as",
- "ay",
- "az",
- "ba",
- "be",
- "bg",
- "bh",
- "bi",
- "bn",
- "bo",
- "br",
- "ca",
- "co",
- "cs",
- "cy",
- "da",
- "de",
- "dz",
- "el",
- "en",
- "eo",
- "es",
- "et",
- "eu",
- "fa",
- "fi",
- "fj",
- "fo",
- "fr",
- "fy",
- "ga",
- "gd",
- "gl",
- "gn",
- "gu",
- "ha",
- "he",
- "hi",
- "hr",
- "hu",
- "hy",
- "ia",
- "ie",
- "ik",
- "id",
- "is",
- "it",
- "iu",
- "ja",
- "jv",
- "ka",
- "kk",
- "kl",
- "km",
- "kn",
- "ko",
- "ks",
- "ku",
- "ky",
- "la",
- "ln",
- "lo",
- "lt",
- "lv",
- "mg",
- "mi",
- "mk",
- "ml",
- "mn",
- "mo",
- "mr",
- "ms",
- "mt",
- "my",
- "na",
- "ne",
- "nl",
- "no",
- "oc",
- "om",
- "or",
- "pa",
- "pl",
- "ps",
- "pt",
- "qu",
- "rm",
- "rn",
- "ro",
- "ru",
- "rw",
- "sa",
- "sd",
- "sg",
- "sh",
- "si",
- "sk",
- "sl",
- "sm",
- "sn",
- "so",
- "sq",
- "sr",
- "ss",
- "st",
- "su",
- "sv",
- "sw",
- "ta",
- "te",
- "tg",
- "th",
- "ti",
- "tk",
- "tl",
- "tn",
- "to",
- "tr",
- "ts",
- "tt",
- "tw",
- "ug",
- "uk",
- "ur",
- "uz",
- "vi",
- "vo",
- "wo",
- "xh",
- "yi",
- "yo",
- "za",
- "zh",
- "zu"
- );
- }
-
- /**
- * @return array
- */
- public static function _getLanguages(): array
- {
- global $DIC;
-
- $lng = $DIC->language();
-
- $lng->loadLanguageModule("meta");
-
- $langs = array();
- foreach (self::_getPossibleLanguageCodes() as $lngcode) {
- $langs[$lngcode] = $lng->txt("meta_l_" . $lngcode);
- }
- asort($langs);
- return $langs;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDLifecycle.php b/components/ILIAS/MetaData/classes/class.ilMDLifecycle.php
deleted file mode 100755
index d5a15b1b8c2e..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDLifecycle.php
+++ /dev/null
@@ -1,255 +0,0 @@
-
- * @package ilias-core
- * @version $Id$
- * @deprecated will be removed with ILIAS 11, please use the new API (see {@see ../docs/api.md})
- */
-class ilMDLifecycle extends ilMDBase
-{
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private const STATUS_TRANSLATION = [
- 'draft' => 'Draft',
- 'final' => 'Final',
- 'revised' => 'Revised',
- 'unavailable' => 'Unavailable'
- ];
-
- private ?ilMDLanguageItem $version_language = null;
- private string $version = "";
- private string $status = "";
-
- /**
- * @return array
- */
- public function getPossibleSubelements(): array
- {
- $subs['Contribute'] = 'meta_contribute';
-
- return $subs;
- }
-
- /**
- * @return int[]
- */
- public function getContributeIds(): array
- {
- return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_lifecycle');
- }
-
- public function getContribute(int $a_contribute_id): ?ilMDContribute
- {
- if (!$a_contribute_id) {
- return null;
- }
- $con = new ilMDContribute();
- $con->setMetaId($a_contribute_id);
-
- return $con;
- }
-
- public function addContribute(): ilMDContribute
- {
- $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $con->setParentId($this->getMetaId());
- $con->setParentType('meta_lifecycle');
-
- return $con;
- }
-
- // SET/GET
- public function setStatus(string $a_status): void
- {
- switch ($a_status) {
- case 'Draft':
- case 'Final':
- case 'Revised':
- case 'Unavailable':
- $this->status = $a_status;
- break;
- }
- }
-
- public function getStatus(): string
- {
- return $this->status;
- }
-
- public function setVersion(string $a_version): void
- {
- $this->version = $a_version;
- }
-
- public function getVersion(): string
- {
- return $this->version;
- }
-
- public function setVersionLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->version_language = $lng_obj;
- }
-
- public function getVersionLanguage(): ilMDLanguageItem
- {
- return $this->version_language;
- }
-
- public function getVersionLanguageCode(): string
- {
- return is_object($this->version_language) ? $this->version_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_lifecycle_id'] = array('integer', $next_id = $this->db->nextId('il_meta_lifecycle'));
-
- if ($this->db->insert('il_meta_lifecycle', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_lifecycle',
- $this->__getFields(),
- array("meta_lifecycle_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- // Delete 'contribute'
- foreach ($this->getContributeIds() as $id) {
- $con = $this->getContribute($id);
- $con->delete();
- }
-
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_lifecycle " .
- "WHERE meta_lifecycle_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $status = (string) array_search(
- $this->getStatus(),
- self::STATUS_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'lifecycle_status' => array('text', $status),
- 'meta_version' => array('text', $this->getVersion()),
- 'version_language' => array('text', $this->getVersionLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_lifecycle " .
- "WHERE meta_lifecycle_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->lifecycle_status ?? '', self::STATUS_TRANSLATION)) {
- $row->lifecycle_status = self::STATUS_TRANSLATION[$row->lifecycle_status ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setStatus($row->lifecycle_status ?? '');
- $this->setVersion($row->meta_version ?? '');
- $this->setVersionLanguage(new ilMDLanguageItem($row->version_language ?? ''));
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Lifecycle', array(
- 'Status' => $this->getStatus() ?: 'Draft'
- ));
- $writer->xmlElement(
- 'Version',
- array(
- 'Language' => $this->getVersionLanguageCode() ?: 'en'
- ),
- $this->getVersion()
- );
-
- // contribute
- $contributes = $this->getContributeIds();
- foreach ($contributes as $id) {
- $con = $this->getContribute($id);
- $con->toXML($writer);
- }
- if (!count($contributes)) {
- $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
- $con->toXML($writer);
- }
- $writer->xmlEndTag('Lifecycle');
- }
-
- // STATIC
- public static function _getId(int $a_rbac_id, int $a_obj_id): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- return (int) $row->meta_lifecycle_id;
- }
- return 0;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDLocation.php b/components/ILIAS/MetaData/classes/class.ilMDLocation.php
deleted file mode 100755
index 63260ad8516e..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDLocation.php
+++ /dev/null
@@ -1,157 +0,0 @@
-location = $a_location;
- }
-
- public function getLocation(): string
- {
- return $this->location;
- }
-
- public function setLocationType(string $a_location_type): void
- {
- $this->location_type = $a_location_type;
- }
-
- public function getLocationType(): string
- {
- return $this->location_type;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_location_id'] = array('integer', $next_id = $this->db->nextId('il_meta_location'));
-
- if ($this->db->insert('il_meta_location', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_location',
- $this->__getFields(),
- array("meta_location_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_location " .
- "WHERE meta_location_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- 'location' => array('text', $this->getLocation()),
- 'location_type' => array('text', $this->getLocationType())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_location " .
- "WHERE meta_location_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type);
- $this->setLocation($row->location ?? '');
- $this->setLocationType($row->location_type ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlElement(
- 'Location',
- array(
- 'Type' => $this->getLocationType() ?: 'LocalFile'
- ),
- $this->getLocation()
- );
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_location_id FROM il_meta_location " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_location_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDMetaMetadata.php b/components/ILIAS/MetaData/classes/class.ilMDMetaMetadata.php
deleted file mode 100755
index 247e579c3aa5..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDMetaMetadata.php
+++ /dev/null
@@ -1,358 +0,0 @@
-
- */
- public function getPossibleSubelements(): array
- {
- $subs['Identifier'] = 'meta_identifier';
- $subs['Contribute'] = 'meta_contribute';
-
- return $subs;
- }
-
- // SUBELEMENTS
-
- /**
- * @return int[]
- */
- public function getIdentifierIds(): array
- {
- return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
- }
-
- public function getIdentifier(int $a_identifier_id): ?ilMDIdentifier
- {
- if (!$a_identifier_id) {
- return null;
- }
- $ide = new ilMDIdentifier();
- $ide->setMetaId($a_identifier_id);
-
- return $ide;
- }
-
- public function addIdentifier(): ilMDIdentifier
- {
- $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $ide->setParentId($this->getMetaId());
- $ide->setParentType('meta_meta_data');
-
- return $ide;
- }
-
- /**
- * @return int[]
- */
- public function getContributeIds(): array
- {
- return ilMDContribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
- }
-
- public function getContribute(int $a_contribute_id): ?ilMDContribute
- {
- if (!$a_contribute_id) {
- return null;
- }
- $con = new ilMDContribute();
- $con->setMetaId($a_contribute_id);
-
- return $con;
- }
-
- public function addContribute(): ilMDContribute
- {
- $con = new ilMDContribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $con->setParentId($this->getMetaId());
- $con->setParentType('meta_meta_data');
-
- return $con;
- }
-
- // SET/GET
- //TODO: check fixed attribute
- public function setMetaDataScheme(string $a_val): void
- {
- $this->meta_data_scheme = $a_val;
- }
-
- public function getMetaDataScheme(): string
- {
- // Fixed attribute
- return 'LOM v 1.0';
- }
-
- public function setLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->language = $lng_obj;
- }
-
- public function getLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->language) ? $this->language : null;
- }
-
- public function getLanguageCode(): string
- {
- return is_object($this->language) ? $this->language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_meta_data_id'] = array('integer', $next_id = $this->db->nextId('il_meta_meta_data'));
-
- if ($this->db->insert('il_meta_meta_data', $fields)) {
- $this->setMetaId($next_id);
- $this->createOrUpdateFirstSchema();
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- if (!$this->getMetaId()) {
- return false;
- }
-
- $this->createOrUpdateFirstSchema();
-
- return (bool) $this->db->update(
- 'il_meta_meta_data',
- $this->__getFields(),
- array("meta_meta_data_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_meta_data " .
- "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- $this->deleteAllSchemas();
-
- foreach ($this->getIdentifierIds() as $id) {
- $ide = $this->getIdentifier($id);
- $ide->delete();
- }
-
- foreach ($this->getContributeIds() as $id) {
- $con = $this->getContribute($id);
- $con->delete();
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- //'meta_data_scheme' => array('text', $this->getMetaDataScheme()),
- 'language' => array('text', $this->getLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_meta_data " .
- "WHERE meta_meta_data_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type);
- //$this->setMetaDataScheme($row->meta_data_scheme ?? '');
- $this->setLanguage(new ilMDLanguageItem($row->language ?? ''));
- }
-
- $this->readFirstSchema();
-
- return true;
- }
- return false;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $attr = null;
- if ($this->getMetaDataScheme()) {
- $attr['MetadataScheme'] = $this->getMetaDataScheme();
- }
- if ($this->getLanguageCode()) {
- $attr['Language'] = $this->getLanguageCode();
- }
- $writer->xmlStartTag('Meta-Metadata', $attr);
-
- // ELEMENT IDENTIFIER
- $identifiers = $this->getIdentifierIds();
- foreach ($identifiers as $id) {
- $ide = $this->getIdentifier($id);
- $ide->toXML($writer);
- }
- if (!count($identifiers)) {
- $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId());
- $ide->toXML($writer);
- }
-
- // ELEMETN Contribute
- $contributes = $this->getContributeIds();
- foreach ($contributes as $id) {
- $con = $this->getContribute($id);
- $con->toXML($writer);
- }
- if (!count($contributes)) {
- $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
- $con->toXML($writer);
- }
-
- $writer->xmlEndTag('Meta-Metadata');
- }
-
- // STATIC
- public static function _getId(int $a_rbac_id, int $a_obj_id): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_meta_data_id FROM il_meta_meta_data " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- return (int) $row->meta_meta_data_id;
- }
- return 0;
- }
-
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateFirstSchema(): void
- {
- if ($this->getMetaDataScheme() === '') {
- return;
- }
-
- if (!$this->getSchemaId()) {
- $this->db->insert(
- 'il_meta_meta_schema',
- [
- 'meta_meta_schema_id' => ['integer', $next_id = $this->db->nextId('il_meta_meta_schema')],
- 'rbac_id' => ['integer', $this->getRBACId()],
- 'obj_id' => ['integer', $this->getObjId()],
- 'obj_type' => ['text', $this->getObjType()],
- 'parent_type' => ['text', 'meta_general'],
- 'parent_id' => ['integer', $this->getMetaId()],
- 'meta_data_schema' => ['text', 'LOMv1.0'],
- ]
- );
- $this->schema_id = $next_id;
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllSchemas(): void
- {
- $query = "DELETE FROM il_meta_meta_schema WHERE parent_type = 'meta_meta_data'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstSchema(): void
- {
- $query = "SELECT * FROM il_meta_meta_schema WHERE meta_meta_schema_id = " .
- $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->setMetaDataScheme((string) $row['meta_data_schema']);
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getSchemaId(): int
- {
- return $this->schema_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readSchemaId(int $parent_id): void
- {
- $query = "SELECT meta_meta_schema_id FROM il_meta_meta_schema WHERE parent_type = 'meta_meta_data'
- AND parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_meta_schema_id";
-
- $res = $this->db->query($query);
- if ($row = $this->db->fetchAssoc($res)) {
- $this->schema_id = (int) $row['meta_meta_schema_id'];
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
- {
- $this->readSchemaId($a_meta_id);
- parent::setMetaId($a_meta_id, $a_read_data);
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDOrComposite.php b/components/ILIAS/MetaData/classes/class.ilMDOrComposite.php
deleted file mode 100755
index 79464e860f70..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDOrComposite.php
+++ /dev/null
@@ -1,151 +0,0 @@
-or_composite_id = $a_or_composite_id;
- }
-
- public function getOrCompositeId(): int
- {
- if (!$this->or_composite_id) {
- $query = "SELECT MAX(or_composite_id) orc FROM il_meta_requirement " .
- "WHERE rbac_id = " . $this->db->quote($this->getRBACId(), 'integer') . " " .
- "AND obj_id = " . $this->db->quote($this->getObjId(), 'integer') . " ";
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->or_composite_id = (int) $row->orc;
- }
- ++$this->or_composite_id;
- }
- return $this->or_composite_id;
- }
-
- /**
- * @return int[]
- */
- public function getRequirementIds(): array
- {
- return ilMDRequirement::_getIds(
- $this->getRBACId(),
- $this->getObjId(),
- $this->getParentId(),
- 'meta_technical',
- $this->getOrCompositeId()
- );
- }
-
- public function getRequirement(int $a_requirement_id): ?ilMDRequirement
- {
- if (!$a_requirement_id) {
- return null;
- }
- $req = new ilMDRequirement();
- $req->setMetaId($a_requirement_id);
-
- return $req;
- }
-
- public function addRequirement(): ilMDRequirement
- {
- $req = new ilMDRequirement($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $req->setParentId($this->getParentId());
- $req->setParentType('meta_technical');
- $req->setOrCompositeId($this->getOrCompositeId());
-
- return $req;
- }
-
- public function save(): int
- {
- echo 'Use ilMDOrcomposite::addRequirement()';
- return 0;
- }
-
- public function delete(): bool
- {
- foreach ($this->getRequirementIds() as $id) {
- $req = $this->getRequirement($id);
- $req->delete();
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- // For all requirements
- $writer->xmlStartTag('OrComposite');
-
- $reqs = $this->getRequirementIds();
- foreach ($reqs as $id) {
- $req = $this->getRequirement($id);
- $req->toXML($writer);
- }
- if (!count($reqs)) {
- $req = new ilMDRequirement($this->getRBACId(), $this->getObjId());
- $req->toXML($writer);
- }
- $writer->xmlEndTag('OrComposite');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(
- int $a_rbac_id,
- int $a_obj_id,
- int $a_parent_id,
- string $a_parent_type,
- int $a_or_composite_id = 0
- ): array {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT DISTINCT(or_composite_id) or_composite_id FROM il_meta_requirement " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
- "AND or_composite_id > 0 ";
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->or_composite_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDRelation.php b/components/ILIAS/MetaData/classes/class.ilMDRelation.php
deleted file mode 100755
index 716f3aeefcc1..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDRelation.php
+++ /dev/null
@@ -1,278 +0,0 @@
- 'IsPartOf',
- 'haspart' => 'HasPart',
- 'isversionof' => 'IsVersionOf',
- 'hasversion' => 'HasVersion',
- 'isformatof' => 'IsFormatOf',
- 'hasformat' => 'HasFormat',
- 'references' => 'References',
- 'isreferencedby' => 'IsReferencedBy',
- 'isbasedon' => 'IsBasedOn',
- 'isbasisfor' => 'IsBasisFor',
- 'requires' => 'Requires',
- 'isrequiredby' => 'IsRequiredBy'
- ];
-
- private string $kind = '';
-
- // METHODS OF CHILD OBJECTS (Taxon)
-
- /**
- * @return int[]
- */
- public function getIdentifier_Ids(): array
- {
- return ilMDIdentifier_::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_relation');
- }
-
- public function getIdentifier_(int $a_identifier__id): ?ilMDIdentifier_
- {
- if (!$a_identifier__id) {
- return null;
- }
- $ide = new ilMDIdentifier_();
- $ide->setMetaId($a_identifier__id);
-
- return $ide;
- }
-
- public function addIdentifier_(): ilMDIdentifier_
- {
- $ide = new ilMDIdentifier_($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $ide->setParentId($this->getMetaId());
- $ide->setParentType('meta_relation');
-
- return $ide;
- }
-
- /**
- * @return int[]
- */
- public function getDescriptionIds(): array
- {
- return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_relation');
- }
-
- public function getDescription(int $a_description_id): ?ilMDDescription
- {
- if (!$a_description_id) {
- return null;
- }
- $des = new ilMDDescription();
- $des->setMetaId($a_description_id);
-
- return $des;
- }
-
- public function addDescription(): ilMDDescription
- {
- $des = new ilMDDescription($this->getRBACId(), $this->getObjId(), $this->getObjType());
- $des->setParentId($this->getMetaId());
- $des->setParentType('meta_relation');
-
- return $des;
- }
-
- // SET/GET
- public function setKind(string $a_kind): bool
- {
- switch ($a_kind) {
- case 'IsPartOf':
- case 'HasPart':
- case 'IsVersionOf':
- case 'HasVersion':
- case 'IsFormatOf':
- case 'HasFormat':
- case 'References':
- case 'IsReferencedBy':
- case 'IsBasedOn':
- case 'IsBasisFor':
- case 'Requires':
- case 'IsRequiredBy':
- $this->kind = $a_kind;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getKind(): string
- {
- return $this->kind;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_relation_id'] = array('integer', $next_id = $this->db->nextId('il_meta_relation'));
-
- if ($this->db->insert('il_meta_relation', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_relation',
- $this->__getFields(),
- array("meta_relation_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_relation " .
- "WHERE meta_relation_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- foreach ($this->getIdentifier_Ids() as $id) {
- $ide = $this->getIdentifier_($id);
- $ide->delete();
- }
- foreach ($this->getDescriptionIds() as $id) {
- $des = $this->getDescription($id);
- $des->delete();
- }
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $kind = (string) array_search(
- $this->getKind(),
- self::KIND_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'kind' => array('text', $kind)
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_relation " .
- "WHERE meta_relation_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->kind ?? '', self::KIND_TRANSLATION)) {
- $row->kind = self::KIND_TRANSLATION[$row->kind ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type);
- $this->setKind($row->kind ?? '');
- }
- }
- return true;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Relation', array(
- 'Kind' => $this->getKind() ?: 'IsPartOf'
- ));
- $writer->xmlStartTag('Resource');
-
- // Identifier_
- $ides = $this->getIdentifier_Ids();
- foreach ($ides as $id) {
- $ide = $this->getIdentifier_($id);
- $ide->toXML($writer);
- }
- if (!count($ides)) {
- $ide = new ilMDIdentifier_($this->getRBACId(), $this->getObjId());
- $ide->toXML($writer);
- }
-
- // Description
- $dess = $this->getDescriptionIds();
- foreach ($dess as $id) {
- $des = $this->getDescription($id);
- $des->toXML($writer);
- }
- if (!count($dess)) {
- $des = new ilMDDescription($this->getRBACId(), $this->getObjId());
- $des->toXML($writer);
- }
-
- $writer->xmlEndTag('Resource');
- $writer->xmlEndTag('Relation');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(int $a_rbac_id, int $a_obj_id): array
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_relation_id FROM il_meta_relation " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_relation_id;
- }
- return $ids;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDRequirement.php b/components/ILIAS/MetaData/classes/class.ilMDRequirement.php
deleted file mode 100755
index 8c6510ac9462..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDRequirement.php
+++ /dev/null
@@ -1,478 +0,0 @@
- 'PC-DOS',
- 'ms-windows' => 'MS-Windows',
- 'macos' => 'MacOS',
- 'unix' => 'Unix',
- 'multi-os' => 'Multi-OS',
- 'none' => 'None'
- ];
-
- private const BROWSER_TRANSLATION = [
- 'any' => 'Any',
- 'netscape communicator' => 'NetscapeCommunicator',
- 'ms-internet explorer' => 'MS-InternetExplorer',
- 'opera' => 'Opera',
- 'amaya' => 'Amaya'
- ];
-
- private int $or_composite_id = 0;
- private string $operating_system_name = '';
- private string $operating_system_minimum_version = '';
- private string $operating_system_maximum_version = '';
- private string $browser_name = '';
- private string $browser_minimum_version = '';
- private string $browser_maximum_version = '';
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- private int $or_id_browser = 0;
- private int $or_id_os = 0;
-
- // SET/GET
- public function setOrCompositeId(int $a_or_composite_id): void
- {
- $this->or_composite_id = $a_or_composite_id;
- }
-
- public function getOrCompositeId(): int
- {
- return $this->or_composite_id;
- }
-
- public function setOperatingSystemName(string $a_val): bool
- {
- switch ($a_val) {
- case 'PC-DOS':
- case 'MS-Windows':
- case 'MacOS':
- case 'Unix':
- case 'Multi-OS':
- case 'None':
- $this->operating_system_name = $a_val;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getOperatingSystemName(): string
- {
- return $this->operating_system_name;
- }
-
- public function setOperatingSystemMinimumVersion(string $a_val): void
- {
- $this->operating_system_minimum_version = $a_val;
- }
-
- public function getOperatingSystemMinimumVersion(): string
- {
- return $this->operating_system_minimum_version;
- }
-
- public function setOperatingSystemMaximumVersion(string $a_val): void
- {
- $this->operating_system_maximum_version = $a_val;
- }
-
- public function getOperatingSystemMaximumVersion(): string
- {
- return $this->operating_system_maximum_version;
- }
-
- public function setBrowserName(string $a_val): bool
- {
- switch ($a_val) {
- case 'Any':
- case 'NetscapeCommunicator':
- case 'MS-InternetExplorer':
- case 'Opera':
- case 'Amaya':
- case 'Mozilla':
- $this->browser_name = $a_val;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getBrowserName(): string
- {
- return $this->browser_name;
- }
-
- public function setBrowserMinimumVersion(string $a_val): void
- {
- $this->browser_minimum_version = $a_val;
- }
-
- public function getBrowserMinimumVersion(): string
- {
- return $this->browser_minimum_version;
- }
-
- public function setBrowserMaximumVersion(string $a_val): void
- {
- $this->browser_maximum_version = $a_val;
- }
-
- public function getBrowserMaximumVersion(): string
- {
- return $this->browser_maximum_version;
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_requirement_id'] = array('integer', $next_id = $this->db->nextId('il_meta_requirement'));
-
- if ($this->db->insert('il_meta_requirement', $fields)) {
- $this->setMetaId($next_id);
- $this->createOrUpdateOrs();
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- if (!$this->getMetaId()) {
- return false;
- }
-
- $this->createOrUpdateOrs();
-
- return (bool) $this->db->update(
- 'il_meta_requirement',
- $this->__getFields(),
- array("meta_requirement_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_requirement " .
- "WHERE meta_requirement_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
-
- $this->deleteAllOrs();
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'parent_type' => array('text', $this->getParentType()),
- 'parent_id' => array('integer', $this->getParentId()),
- //'operating_system_name' => array('text', $this->getOperatingSystemName()),
- //'os_min_version' => array('text', $this->getOperatingSystemMinimumVersion()),
- //'os_max_version' => array('text', $this->getOperatingSystemMaximumVersion()),
- //'browser_name' => array('text', $this->getBrowserName()),
- //'browser_minimum_version' => array('text', $this->getBrowserMinimumVersion()),
- //'browser_maximum_version' => array('text', $this->getBrowserMaximumVersion()),
- 'or_composite_id' => array('integer', $this->getOrCompositeId())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_requirement " .
- "WHERE meta_requirement_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setParentId((int) $row->parent_id);
- $this->setParentType($row->parent_type);
- //$this->setOperatingSystemName($row->operating_system_name ?? '');
- //$this->setOperatingSystemMinimumVersion($row->os_min_version ?? '');
- //$this->setOperatingSystemMaximumVersion($row->os_max_version ?? '');
- //$this->setBrowserName($row->browser_name ?? '');
- //$this->setBrowserMinimumVersion($row->browser_minimum_version ?? '');
- //$this->setBrowserMaximumVersion($row->browser_maximum_version ?? '');
- $this->setOrCompositeId((int) $row->or_composite_id);
- }
-
- $this->readFirstOrs();
- }
- return true;
- }
-
- /*
- * XML Export of all meta data
- * @param object (xml writer) see class.ilMD2XML.php
- *
- */
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Requirement');
- $writer->xmlStartTag('Type');
-
- if ($this->getOperatingSystemName() !== '') {
- $writer->xmlElement('OperatingSystem', array(
- 'Name' => $this->getOperatingSystemName() ?: 'None',
- 'MinimumVersion' => $this->getOperatingSystemMinimumVersion(),
- 'MaximumVersion' => $this->getOperatingSystemMaximumVersion()
- ));
- }
- if ($this->getBrowserName() !== '') {
- $writer->xmlElement('Browser', array(
- 'Name' => $this->getBrowserName() ?: 'Any',
- 'MinimumVersion' => $this->getBrowserMinimumVersion(),
- 'MaximumVersion' => $this->getBrowserMaximumVersion()
- ));
- }
- $writer->xmlEndTag('Type');
- $writer->xmlEndTag('Requirement');
- }
-
- // STATIC
-
- /**
- * @return int[]
- */
- public static function _getIds(
- int $a_rbac_id,
- int $a_obj_id,
- int $a_parent_id,
- string $a_parent_type,
- int $a_or_composite_id = 0
- ): array {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_requirement_id FROM il_meta_requirement " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
- "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
- "AND parent_type = " . $ilDB->quote($a_parent_type, 'text') . " " .
- "AND or_composite_id = " . $ilDB->quote($a_or_composite_id, 'integer');
-
- $res = $ilDB->query($query);
- $ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $ids[] = (int) $row->meta_requirement_id;
- }
- return $ids;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateOrs(): void
- {
- $os_name = (string) array_search(
- $this->getOperatingSystemName(),
- self::OS_TRANSLATION
- );
- $browser_name = (string) array_search(
- $this->getBrowserName(),
- self::BROWSER_TRANSLATION
- );
-
- $this->or_id_os = $this->createOrUpdateOr(
- $this->getOrIdOS(),
- 'operating system',
- $os_name,
- $this->getOperatingSystemMinimumVersion(),
- $this->getOperatingSystemMaximumVersion()
- );
-
- $this->or_id_browser = $this->createOrUpdateOr(
- $this->getOrIdBrowser(),
- 'browser',
- $browser_name,
- $this->getBrowserMinimumVersion(),
- $this->getBrowserMaximumVersion()
- );
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function createOrUpdateOr(
- int $id,
- string $type,
- string $name,
- string $min_version,
- string $max_version
- ): int {
- if ($name === '' && $min_version === '' && $max_version === '') {
- return 0;
- }
-
- if (!$id) {
- $this->db->insert(
- 'il_meta_or_composite',
- [
- 'meta_or_composite_id' => ['integer', $next_id = $this->db->nextId('il_meta_or_composite')],
- 'rbac_id' => ['integer', $this->getRBACId()],
- 'obj_id' => ['integer', $this->getObjId()],
- 'obj_type' => ['text', $this->getObjType()],
- 'parent_type' => ['text', 'meta_requirement'],
- 'parent_id' => ['integer', $this->getMetaId()],
- 'type' => ['text', $type],
- 'name' => ['text', $name],
- 'min_version' => ['text', $min_version],
- 'max_version' => ['text', $max_version]
- ]
- );
- return $next_id;
- }
-
- $this->db->update(
- 'il_meta_or_composite',
- [
- 'type' => ['text', $type],
- 'name' => ['text', $name],
- 'min_version' => ['text', $min_version],
- 'max_version' => ['text', $max_version]
- ],
- ['meta_or_composite_id' => ['integer', $id]]
- );
- return $id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function deleteAllOrs(): void
- {
- $query = "DELETE FROM il_meta_or_composite WHERE parent_type = 'meta_requirement'
- AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
- $res = $this->db->manipulate($query);
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readFirstOrs(): void
- {
- $query = "SELECT * FROM il_meta_or_composite WHERE meta_or_composite_id = " .
- $this->db->quote($this->getOrIdOS(), 'integer') .
- " OR meta_or_composite_id = " . $this->db->quote($this->getOrIdBrowser(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $this->db->fetchAssoc($res)) {
- switch ($row['type']) {
- case 'operating system':
- if (key_exists($row['name'] ?? '', self::OS_TRANSLATION)) {
- $row['name'] = self::OS_TRANSLATION[$row['name'] ?? ''];
- }
- $this->setOperatingSystemName($row['name'] ?? '');
- $this->setOperatingSystemMinimumVersion($row['min_version'] ?? '');
- $this->setOperatingSystemMaximumVersion($row['max_version'] ?? '');
- break;
-
- case 'browser':
- if (key_exists($row['name'] ?? '', self::BROWSER_TRANSLATION)) {
- $row['name'] = self::BROWSER_TRANSLATION[$row['name'] ?? ''];
- }
- $this->setBrowserName($row['name'] ?? '');
- $this->setBrowserMinimumVersion($row['min_version'] ?? '');
- $this->setBrowserMaximumVersion($row['max_version'] ?? '');
- break;
- }
- }
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function readOrIds(int $parent_id): void
- {
- $query = "SELECT meta_or_composite_id, type FROM il_meta_or_composite WHERE
- parent_id = " . $this->db->quote($parent_id, 'integer') .
- " ORDER BY meta_or_composite_id";
-
- $res = $this->db->query($query);
- $browser_id = 0;
- $os_id = 0;
- while ($row = $this->db->fetchAssoc($res)) {
- if (!$browser_id && $row['type'] === 'browser') {
- $browser_id = (int) $row['meta_or_composite_id'];
- }
- if (!$os_id && $row['type'] === 'operating system') {
- $os_id = (int) $row['meta_or_composite_id'];
- }
- if ($browser_id && $os_id) {
- break;
- }
- }
-
- $this->or_id_browser = $browser_id;
- $this->or_id_os = $os_id;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getOrIdOS(): int
- {
- return $this->or_id_os ?? 0;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- protected function getOrIdBrowser(): int
- {
- return $this->or_id_browser ?? 0;
- }
-
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
- {
- $this->readOrIds($a_meta_id);
- parent::setMetaId($a_meta_id, $a_read_data);
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDRights.php b/components/ILIAS/MetaData/classes/class.ilMDRights.php
deleted file mode 100755
index 92c894680e86..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDRights.php
+++ /dev/null
@@ -1,284 +0,0 @@
- 'Yes',
- 'no' => 'No'
- ];
-
- private string $costs = '';
- private string $caor = '';
- private string $description = '';
- private ?ilMDLanguageItem $description_language = null;
-
- /**
- * @param string[] $a_types
- * @param string[] $a_copyright
- * @return int[]
- */
- public static function lookupRightsByTypeAndCopyright(array $a_types, array $a_copyright): array
- {
- global $DIC;
-
- $db = $DIC->database();
-
- $query = 'SELECT rbac_id FROM il_meta_rights ' .
- 'WHERE ' . $db->in('obj_type', $a_types, false, 'text') . ' ' .
- 'AND ' . $db->in('description', $a_copyright, false, 'text');
- $res = $db->query($query);
-
- ilLoggerFactory::getLogger('meta')->info($query);
-
- $obj_ids = [];
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- $obj_ids[] = (int) $row->rbac_id;
- }
- return $obj_ids;
- }
-
- // SET/GET
- public function setCosts(string $a_costs): bool
- {
- switch ($a_costs) {
- case 'Yes':
- case 'No':
- $this->costs = $a_costs;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getCosts(): string
- {
- return $this->costs;
- }
-
- public function setCopyrightAndOtherRestrictions(string $a_caor): bool
- {
- switch ($a_caor) {
- case 'Yes':
- case 'No':
- $this->caor = $a_caor;
- return true;
-
- default:
- return false;
- }
- }
-
- public function getCopyrightAndOtherRestrictions(): string
- {
- return $this->caor;
- }
-
- public function setDescription(string $a_description): void
- {
- $this->description = $a_description;
- }
-
- public function getDescription(): string
- {
- return $this->description;
- }
-
- public function setDescriptionLanguage(ilMDLanguageItem $lng_obj): void
- {
- $this->description_language = $lng_obj;
- }
-
- public function getDescriptionLanguage(): ?ilMDLanguageItem
- {
- return is_object($this->description_language) ? $this->description_language : null;
- }
-
- public function getDescriptionLanguageCode(): string
- {
- return is_object($this->description_language) ? $this->description_language->getLanguageCode() : '';
- }
-
- public function save(): int
- {
- $fields = $this->__getFields();
- $fields['meta_rights_id'] = array('integer', $next_id = $this->db->nextId('il_meta_rights'));
-
- if ($this->db->insert('il_meta_rights', $fields)) {
- $this->setMetaId($next_id);
- return $this->getMetaId();
- }
- return 0;
- }
-
- public function update(): bool
- {
- return $this->getMetaId() && $this->db->update(
- 'il_meta_rights',
- $this->__getFields(),
- array("meta_rights_id" => array('integer', $this->getMetaId()))
- );
- }
-
- public function delete(): bool
- {
- if ($this->getMetaId()) {
- $query = "DELETE FROM il_meta_rights " .
- "WHERE meta_rights_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $this->db->query($query);
-
- return true;
- }
- return false;
- }
-
- /**
- * @return array>
- */
- public function __getFields(): array
- {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- $costs = (string) array_search(
- $this->getCosts(),
- self::YES_NO_TRANSLATION
- );
- $cpr_and_or = (string) array_search(
- $this->getCopyrightAndOtherRestrictions(),
- self::YES_NO_TRANSLATION
- );
-
- return array(
- 'rbac_id' => array('integer', $this->getRBACId()),
- 'obj_id' => array('integer', $this->getObjId()),
- 'obj_type' => array('text', $this->getObjType()),
- 'costs' => array('text', $costs),
- 'cpr_and_or' => array('text', $cpr_and_or),
- 'description' => array('text', $this->getDescription()),
- 'description_language' => array('text', $this->getDescriptionLanguageCode())
- );
- }
-
- public function read(): bool
- {
- if ($this->getMetaId()) {
- $query = "SELECT * FROM il_meta_rights " .
- "WHERE meta_rights_id = " . $this->db->quote($this->getMetaId(), 'integer');
-
- $res = $this->db->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- /**
- * Compatibility fix for legacy MD classes for new db tables
- */
- if (key_exists($row->costs ?? '', self::YES_NO_TRANSLATION)) {
- $row->costs = self::YES_NO_TRANSLATION[$row->costs ?? ''];
- }
- if (key_exists($row->cpr_and_or ?? '', self::YES_NO_TRANSLATION)) {
- $row->cpr_and_or = self::YES_NO_TRANSLATION[$row->cpr_and_or ?? ''];
- }
-
- $this->setRBACId((int) $row->rbac_id);
- $this->setObjId((int) $row->obj_id);
- $this->setObjType($row->obj_type ?? '');
- $this->setDescription($row->description ?? '');
- $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language ?? ''));
- $this->setCosts($row->costs ?? '');
- $this->setCopyrightAndOtherRestrictions($row->cpr_and_or ?? '');
- }
- return true;
- }
- return false;
- }
-
- public function toXML(ilXmlWriter $writer): void
- {
- $writer->xmlStartTag('Rights', array(
- 'Cost' => $this->getCosts() ?: 'No',
- 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions() ?: 'No'
- ));
-
- $writer->xmlElement(
- 'Description',
- [
- 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
- ],
- ilMDCopyrightSelectionEntry::_lookupCopyrightForExport($this->getDescription())
- );
- $writer->xmlEndTag('Rights');
- }
-
- public function parseDescriptionFromImport(string $a_description): void
- {
- $entry_id = ilMDCopyrightSelectionEntry::lookupCopyrightFromImport($a_description);
- if (!$entry_id) {
- $this->setDescription($a_description);
- } else {
- $this->setDescription(ilMDCopyrightSelectionEntry::createIdentifier($entry_id));
- }
- }
-
- public static function _lookupDescription(int $a_rbac_id, int $a_obj_id): string
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT description FROM il_meta_rights " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
- $res = $ilDB->query($query);
- $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
-
- if (isset($row) && isset($row->description)) {
- return $row->description;
- }
- return '';
- }
-
- // STATIC
- public static function _getId(int $a_rbac_id, int $a_obj_id): int
- {
- global $DIC;
-
- $ilDB = $DIC->database();
-
- $query = "SELECT meta_rights_id FROM il_meta_rights " .
- "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
- "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
-
- $res = $ilDB->query($query);
- while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
- return (int) $row->meta_rights_id;
- }
- return 0;
- }
-}
diff --git a/components/ILIAS/MetaData/classes/class.ilMDSaxParser.php b/components/ILIAS/MetaData/classes/class.ilMDSaxParser.php
deleted file mode 100755
index c65ae337208e..000000000000
--- a/components/ILIAS/MetaData/classes/class.ilMDSaxParser.php
+++ /dev/null
@@ -1,703 +0,0 @@
-
- * Inserts Meta data from XML into ILIAS db
- * @extends ilSaxParser
- * @package ilias-core
- * @deprecated will be removed with ILIAS 11, LOM should only be exported as a tail dependency
- */
-class ilMDSaxParser extends ilSaxParser
-{
- protected bool $md_in_md = false;
- protected string $md_chr_data = '';
- protected ?ilMDIdentifier $md_ide = null;
- protected ?ilMDLanguage $md_lan = null;
- protected ?ilMDDescription $md_des = null;
- protected ?ilMDLifecycle $md_lif = null;
- protected ?ilMDContribute $md_con = null;
- protected ?ilMDEntity $md_ent = null;
- protected ?ilMDMetaMetadata $md_met = null;
- protected ?ilMDTechnical $md_tec = null;
- protected ?ilMDFormat $md_for = null;
- protected ?ilMDLocation $md_loc = null;
- protected ?ilMDRequirement $md_req = null;
- protected ?ilMDOrComposite $md_orc = null;
- protected ?ilMDEducational $md_edu = null;
- protected ?ilMDTypicalAgeRange $md_typ = null;
- protected ?ilMDRights $md_rig = null;
- protected ?ilMDRelation $md_rel = null;
- protected ?ilMDIdentifier_ $md_ide_ = null;
- protected ?ilMDAnnotation $md_ann = null;
- protected ?ilMDClassification $md_cla = null;
- protected ?ilMDTaxonPath $md_taxp = null;
- protected ?ilMDTaxon $md_tax = null;
- protected ?ilMDKeyword $md_key = null;
-
- /**
- * Array of mixed ilMD objects
- * @var array |