19declare(strict_types=1);
48 $this->storage =
$DIC->resourceStorage();
50 $object_dic = LocalDIC::dic();
51 $this->properties_aggregator = $object_dic[
'properties.aggregator'];
52 $this->translations_repository = $object_dic[
'properties.translations.repository'];
58 return [
'4.4.0',
'5.1.0',
'5.2.0',
'5.4.0'];
63 return 'http://www.ilias.de/xml/Services/Object/' .
$entity;
71 if (
$entity ==
'transl_entry') {
80 'Description' =>
'text',
82 'LangDefault' =>
'integer'
94 'MasterLang' =>
'text'
98 if (
$entity ==
'service_settings') {
104 'ObjId' =>
'integer',
120 'ObjId' =>
'integer',
121 'Filename' =>
'text',
129 'ObjId' =>
'integer',
142 if (
$entity ==
'transl_entry') {
149 'SELECT obj_id, title, description, lang_code, lang_default' . PHP_EOL
150 .
'FROM object_translation' . PHP_EOL
151 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
164 'SELECT obj_id, lang_code' . PHP_EOL
165 .
'FROM object_translation' . PHP_EOL
166 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
167 .
'AND lang_base = 1'
173 if (
$entity ==
'service_settings') {
179 foreach ($ids as
$id) {
193 foreach ($settings as $s) {
210 foreach ($ids as
$id) {
219 foreach ($ids as
$id) {
220 $rid = $this->properties_aggregator->getFor((
int)
$id)
221 ->getPropertyTileImage()->getTileImage()->getRid();
237 $customIconFactory =
$DIC[
'object.customicons.factory'];
239 foreach ($ids as
$id) {
242 if ($customIcon->exists()) {
245 'Filename' => pathinfo($customIcon->getFullPath(), PATHINFO_BASENAME),
246 'Dir' => dirname($customIcon->getFullPath())
255 $i = $this->storage->manage()->find($rid);
256 $resource = $this->storage->manage()->getResource($i);
257 $path_in_container =
"/dsDir_" . $this->dircnt .
"/" . $resource->getCurrentRevision()->getTitle();
258 $path_in_container = $this->export->isContainerExport()
259 ? $this->export->getPathToComponentExpDirInContainerWithLeadingSetNumber() . $path_in_container
260 : $this->export->getPathToComponentExpDirInContainer() . $path_in_container;
261 $this->export->getExportWriter()->writeFilesByResourceId($rid, $path_in_container);
262 return $path_in_container;
273 $rec[
'ObjId'] = $rec[
'ObjId'] ?? null;
277 'transl' => [
'ids' => $rec[
'ObjId']],
278 'transl_entry' => [
'ids' => $rec[
'ObjId']],
279 'service_settings' => [
'ids' => $rec[
'ObjId']],
280 'tile' => [
'ids' => $rec[
'ObjId']],
281 'icon' => [
'ids' => $rec[
'ObjId']]
288 public function importRecord(
293 string $schema_version
300 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
305 $is_base_lang = $rec[
'LangCode'] === self::$base_lang;
307 $transl = $this->translations_repository->getFor($new_id);
308 $this->translations_repository->store(
309 $transl->withLanguage(
314 (
bool) $rec[
'LangDefault'],
315 $rec[
'LangCode'] === self::$base_lang
320 self::$base_lang =
null;
325 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
329 $transl = $this->translations_repository->getFor($new_id);
330 if ($transl->getLaguageForCode($rec[
'LangCode']) ===
null) {
331 self::$base_lang = $rec[
'LangCode'];
335 $this->translations_repository->store(
336 $transl->withBaseLanguage($rec[
'LangCode'])
340 case 'service_settings':
352 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
354 if (in_array($rec[
'Setting'], $settings)) {
361 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
362 $dir = str_replace(
'..',
'', $rec[
'Dir']);
363 if ($dir !=
'' && $this->getImportDirectory() !=
'') {
364 $source_dir = $this->getImportDirectory() .
'/' . $dir;
366 $customIconFactory =
$DIC[
'object.customicons.factory'];
368 $customIcon->createFromImportDir($source_dir);
373 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
374 $dir = str_replace(
'..',
'', $rec[
'Dir']);
375 if ($new_id > 0 && $dir !=
'' && $this->getImportDirectory() !=
'') {
376 $source_dir = $this->getImportDirectory() .
'/' . $dir;
377 $object_properties = $this->properties_aggregator->getFor($new_id);
378 $ti = $object_properties->getPropertyTileImage()->getTileImage();
379 $ti->createFromImportDir($source_dir);
380 $object_properties->storePropertyTileImage(
381 $object_properties->getPropertyTileImage()->withTileImage($ti)
393 $objDefinition =
$DIC[
'objDefinition'];
395 $new_id = $mapping->
getMapping(
'components/ILIAS/Container',
'objs', $old_id);
397 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'objs', $old_id);
400 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'obj', $old_id);
404 if (substr($k, 0, 17) ==
'components/ILIAS/') {
405 foreach ($m as $type => $map) {
407 if ($objDefinition->isRBACObject($type)) {
408 $new_id = $mapping->
getMapping($k, $type, $old_id);
415 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