19 declare(strict_types=1);
43 $this->storage = $DIC->resourceStorage();
45 $obj_dic = ilObjectDIC::dic();
46 $this->object_properties_agregator = $obj_dic[
'object_properties_agregator'];
52 return [
'4.4.0',
'5.1.0',
'5.2.0',
'5.4.0'];
57 return 'http://www.ilias.de/xml/Services/Object/' .
$entity;
65 if ($entity ==
'transl_entry') {
74 'Description' =>
'text',
76 'LangDefault' =>
'integer' 80 if ($entity ==
'transl') {
88 'MasterLang' =>
'text' 92 if ($entity ==
'service_settings') {
104 if ($entity ==
'common') {
105 if ($version ==
'5.4.0') {
111 if ($entity ==
'icon') {
112 if ($version ==
'5.4.0') {
114 'ObjId' =>
'integer',
115 'Filename' =>
'text',
120 if ($entity ==
'tile') {
121 if ($version ==
'5.4.0') {
123 'ObjId' =>
'integer',
136 if ($entity ==
'transl_entry') {
143 'SELECT obj_id, title, description, lang_code, lang_default' . PHP_EOL
144 .
'FROM object_translation' . PHP_EOL
145 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
151 if ($entity ==
'transl') {
158 'SELECT obj_id, master_lang' . PHP_EOL
159 .
'FROM obj_content_master_lng' . PHP_EOL
160 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
166 if ($entity ==
'service_settings') {
172 foreach ($ids as
$id) {
183 if ($version ==
'5.2.0') {
186 foreach ($settings as $s) {
201 if ($entity ==
'common') {
203 foreach ($ids as
$id) {
210 if ($entity ==
"tile") {
212 foreach ($ids as
$id) {
213 $rid = $this->object_properties_agregator->getFor((
int) $id)
214 ->getPropertyTileImage()->getTileImage()->getRid();
229 if ($entity ==
'icon') {
230 $customIconFactory = $DIC[
'object.customicons.factory'];
232 foreach ($ids as
$id) {
235 if ($customIcon->exists()) {
238 'Filename' => pathinfo($customIcon->getFullPath(), PATHINFO_BASENAME),
239 'Dir' => dirname($customIcon->getFullPath())
248 $i = $this->storage->manage()->find($rid);
249 $stream = $this->storage->consume()->stream(
252 $title = $this->storage->manage()->getCurrentRevision($i)->getTitle();
259 file_put_contents($temp_dir . DIRECTORY_SEPARATOR . $title, $stream->getStream()->getContents());
271 $rec[
'ObjId'] = $rec[
'ObjId'] ?? null;
275 'transl' => [
'ids' => $rec[
'ObjId']],
276 'transl_entry' => [
'ids' => $rec[
'ObjId']],
277 'service_settings' => [
'ids' => $rec[
'ObjId']],
278 'tile' => [
'ids' => $rec[
'ObjId']],
279 'icon' => [
'ids' => $rec[
'ObjId']]
298 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
301 $transl->addLanguage(
305 (
bool) $rec[
'LangDefault'],
313 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
316 $transl->setMasterLanguage($rec[
'MasterLang']);
321 case 'service_settings':
333 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
335 if (in_array($rec[
'Setting'], $settings)) {
342 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
343 $dir = str_replace(
'..',
'', $rec[
'Dir']);
347 $customIconFactory = $DIC[
'object.customicons.factory'];
349 $customIcon->createFromImportDir($source_dir);
354 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
355 $dir = str_replace(
'..',
'', $rec[
'Dir']);
358 $object_properties = $this->object_properties_agregator->getFor($new_id);
359 $ti = $object_properties->getPropertyTileImage()->getTileImage();
360 $ti->createFromImportDir($source_dir);
361 $object_properties->storePropertyTileImage(
362 $object_properties->getPropertyTileImage()->withTileImage($ti)
369 public function getNewObjId(
ilImportMapping $mapping,
string $old_id):
int 374 $objDefinition = $DIC[
'objDefinition'];
376 $new_id = $mapping->
getMapping(
'components/ILIAS/Container',
'objs', $old_id);
378 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'objs', $old_id);
381 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'obj', $old_id);
385 if (substr($k, 0, 17) ==
'components/ILIAS/') {
386 foreach ($m as $type => $map) {
388 if ($objDefinition->isRBACObject($type)) {
389 $new_id = $mapping->
getMapping($k, $type, $old_id);
396 return (
int) $new_id;
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
const CALENDAR_VISIBILITY
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
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 getInstance(int $obj_id)
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 _lookupType(int $id, bool $reference=false)
ilObjectPropertiesAgregator $object_properties_agregator
getXmlNamespace(string $entity, string $schema_version)