19 declare(strict_types=1);
47 $this->storage = $DIC->resourceStorage();
49 $object_dic = LocalDIC::dic();
50 $this->properties_aggregator = $object_dic[
'properties.aggregator'];
51 $this->translations_repository = $object_dic[
'properties.translations.repository'];
57 return [
'4.4.0',
'5.1.0',
'5.2.0',
'5.4.0'];
62 return 'http://www.ilias.de/xml/Services/Object/' .
$entity;
70 if ($entity ==
'transl_entry') {
79 'Description' =>
'text',
81 'LangDefault' =>
'integer' 85 if ($entity ==
'transl') {
93 'MasterLang' =>
'text' 97 if ($entity ==
'service_settings') {
103 'ObjId' =>
'integer',
109 if ($entity ==
'common') {
110 if ($version ==
'5.4.0') {
116 if ($entity ==
'icon') {
117 if ($version ==
'5.4.0') {
119 'ObjId' =>
'integer',
120 'Filename' =>
'text',
125 if ($entity ==
'tile') {
126 if ($version ==
'5.4.0') {
128 'ObjId' =>
'integer',
141 if ($entity ==
'transl_entry') {
148 'SELECT obj_id, title, description, lang_code, lang_default' . PHP_EOL
149 .
'FROM object_translation' . PHP_EOL
150 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
156 if ($entity ==
'transl') {
163 'SELECT obj_id, lang_code' . PHP_EOL
164 .
'FROM object_translation' . PHP_EOL
165 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
166 .
'AND lang_base = 1' 172 if ($entity ==
'service_settings') {
178 foreach ($ids as
$id) {
189 if ($version ==
'5.2.0') {
192 foreach ($settings as $s) {
207 if ($entity ==
'common') {
209 foreach ($ids as
$id) {
216 if ($entity ==
"tile") {
218 foreach ($ids as
$id) {
219 $rid = $this->properties_aggregator->getFor((
int) $id)
220 ->getPropertyTileImage()->getTileImage()->getRid();
235 if ($entity ==
'icon') {
236 $customIconFactory = $DIC[
'object.customicons.factory'];
238 foreach ($ids as
$id) {
241 if ($customIcon->exists()) {
244 'Filename' => pathinfo($customIcon->getFullPath(), PATHINFO_BASENAME),
245 'Dir' => dirname($customIcon->getFullPath())
254 $i = $this->storage->manage()->find($rid);
255 $stream = $this->storage->consume()->stream(
258 $title = $this->storage->manage()->getCurrentRevision($i)->getTitle();
265 file_put_contents($temp_dir . DIRECTORY_SEPARATOR . $title, $stream->getStream()->getContents());
277 $rec[
'ObjId'] = $rec[
'ObjId'] ??
null;
281 'transl' => [
'ids' => $rec[
'ObjId']],
282 'transl_entry' => [
'ids' => $rec[
'ObjId']],
283 'service_settings' => [
'ids' => $rec[
'ObjId']],
284 'tile' => [
'ids' => $rec[
'ObjId']],
285 'icon' => [
'ids' => $rec[
'ObjId']]
304 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
306 $transl = $this->translations_repository->getFor($new_id);
307 $this->translations_repository->store(
308 $transl->withLanguage(
313 (
bool) $rec[
'LangDefault']
321 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
323 $transl = $this->translations_repository->getFor($new_id);
324 $this->translations_repository->store(
325 $transl->withBaseLanguage($rec[
'MasterLang'])
330 case 'service_settings':
342 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
344 if (in_array($rec[
'Setting'], $settings)) {
351 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
352 $dir = str_replace(
'..',
'', $rec[
'Dir']);
356 $customIconFactory = $DIC[
'object.customicons.factory'];
358 $customIcon->createFromImportDir($source_dir);
363 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
364 $dir = str_replace(
'..',
'', $rec[
'Dir']);
367 $object_properties = $this->properties_aggregator->getFor($new_id);
368 $ti = $object_properties->getPropertyTileImage()->getTileImage();
369 $ti->createFromImportDir($source_dir);
370 $object_properties->storePropertyTileImage(
371 $object_properties->getPropertyTileImage()->withTileImage($ti)
378 public function getNewObjId(
ilImportMapping $mapping,
string $old_id):
int 383 $objDefinition = $DIC[
'objDefinition'];
385 $new_id = $mapping->
getMapping(
'components/ILIAS/Container',
'objs', $old_id);
387 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'objs', $old_id);
390 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'obj', $old_id);
394 if (substr($k, 0, 17) ==
'components/ILIAS/') {
395 foreach ($m as $type => $map) {
397 if ($objDefinition->isRBACObject($type)) {
398 $new_id = $mapping->
getMapping($k, $type, $old_id);
405 return (
int) $new_id;
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
Aggregator $properties_aggregator
const CALENDAR_VISIBILITY
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
TranslationsRepository $translations_repository
getTypes(string $entity, string $version)
Get field types for entity.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
copyTileToTempFolderForExport(string $rid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Needs to be overwritten for import use case.
static _hasContainerSetting(int $a_id, string $a_keyword)
getDependencies(string $entity, string $version, ?array $rec=null, ?array $ids=null)
Determine the dependent sets of data.
const AUTO_RATING_NEW_OBJECTS
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
const INFO_TAB_VISIBILITY
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _lookupType(int $id, bool $reference=false)
getXmlNamespace(string $entity, string $schema_version)