19declare(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'
93 'MasterLang' =>
'text'
97 if (
$entity ==
'service_settings') {
103 'ObjId' =>
'integer',
119 'ObjId' =>
'integer',
120 'Filename' =>
'text',
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
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) {
192 foreach ($settings as $s) {
209 foreach ($ids as
$id) {
218 foreach ($ids as
$id) {
219 $rid = $this->properties_aggregator->getFor((
int)
$id)
220 ->getPropertyTileImage()->getTileImage()->getRid();
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']]
292 public function importRecord(
297 string $schema_version
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']);
353 if ($dir !=
'' && $this->getImportDirectory() !=
'') {
354 $source_dir = $this->getImportDirectory() .
'/' . $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']);
365 if ($new_id > 0 && $dir !=
'' && $this->getImportDirectory() !=
'') {
366 $source_dir = $this->getImportDirectory() .
'/' . $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)
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;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
static _hasContainerSetting(int $a_id, string $a_keyword)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
A dataset contains in data in a common structure that can be shared and transformed for different pur...
readData(string $a_entity, string $a_version, array $a_ids)
Read data from DB.
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 ...
getMapping(string $a_comp, string $a_entity, string $a_old_id)
Aggregator $properties_aggregator
copyTileToTempFolderForExport(string $rid)
getXmlNamespace(string $entity, string $schema_version)
getTypes(string $entity, string $version)
Get field types for entity.
TranslationsRepository $translations_repository
getDependencies(string $entity, string $version, ?array $rec=null, ?array $ids=null)
Determine the dependent sets of data.
const AUTO_RATING_NEW_OBJECTS
const INFO_TAB_VISIBILITY
const CALENDAR_VISIBILITY
static _lookupType(int $id, bool $reference=false)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc