19declare(strict_types=1);
49 $this->storage =
$DIC->resourceStorage();
51 $object_dic = LocalDIC::dic();
52 $this->properties_aggregator = $object_dic[
'properties.aggregator'];
53 $this->translations_repository = $object_dic[
'properties.translations.repository'];
59 return [
'4.4.0',
'5.1.0',
'5.2.0',
'5.4.0'];
64 return 'http://www.ilias.de/xml/Services/Object/' .
$entity;
72 if (
$entity ==
'transl_entry') {
81 'Description' =>
'text',
83 'LangDefault' =>
'integer'
95 'MasterLang' =>
'text'
99 if (
$entity ==
'service_settings') {
105 'ObjId' =>
'integer',
121 'ObjId' =>
'integer',
122 'Filename' =>
'text',
130 'ObjId' =>
'integer',
143 if (
$entity ==
'transl_entry') {
150 'SELECT obj_id, title, description, lang_code, lang_default' . PHP_EOL
151 .
'FROM object_translation' . PHP_EOL
152 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
165 'SELECT obj_id, lang_code' . PHP_EOL
166 .
'FROM object_translation' . PHP_EOL
167 .
'WHERE ' . $this->db->in(
'obj_id', $ids,
false,
'integer') . PHP_EOL
168 .
'AND lang_base = 1'
174 if (
$entity ==
'service_settings') {
180 foreach ($ids as
$id) {
194 foreach ($settings as $s) {
211 foreach ($ids as
$id) {
220 foreach ($ids as
$id) {
221 $rid_string = $this->properties_aggregator->getFor((
int)
$id)
222 ->getPropertyTileImage()->getTileImage()->getRid();
223 if ($rid_string ===
null
224 || ($rid = $this->storage->manage()->find($rid_string)) ===
null) {
240 $customIconFactory =
$DIC[
'object.customicons.factory'];
242 foreach ($ids as
$id) {
245 if ($customIcon->exists()) {
248 'Filename' => pathinfo($customIcon->getFullPath(), PATHINFO_BASENAME),
249 'Dir' => dirname($customIcon->getFullPath())
258 $path_in_container =
"/dsDir_{$this->dircnt}/"
259 . $this->storage->manage()->getResource($rid)
260 ->getCurrentRevision()->getTitle();
261 $path_in_container = $this->export->isContainerExport()
262 ? $this->export->getPathToComponentExpDirInContainerWithLeadingSetNumber()
264 : $this->export->getPathToComponentExpDirInContainer()
265 . $path_in_container;
266 $this->export->getExportWriter()->writeFilesByResourceId(
270 return $path_in_container;
281 $rec[
'ObjId'] = $rec[
'ObjId'] ?? null;
285 'transl' => [
'ids' => $rec[
'ObjId']],
286 'transl_entry' => [
'ids' => $rec[
'ObjId']],
287 'service_settings' => [
'ids' => $rec[
'ObjId']],
288 'tile' => [
'ids' => $rec[
'ObjId']],
289 'icon' => [
'ids' => $rec[
'ObjId']]
296 public function importRecord(
301 string $schema_version
308 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
313 $is_base_lang = $rec[
'LangCode'] === self::$base_lang;
315 $transl = $this->translations_repository->getFor($new_id);
316 $this->translations_repository->store(
317 $transl->withLanguage(
322 (
bool) $rec[
'LangDefault'],
323 $rec[
'LangCode'] === self::$base_lang
328 self::$base_lang =
null;
333 $new_id = $this->getNewObjId($mapping, $rec[
'ObjId']);
337 $transl = $this->translations_repository->getFor($new_id);
338 $lang_code = $rec[
'LangCode'] ?? $rec[
'MasterLang'];
339 if ($transl->getLaguageForCode($lang_code) ===
null) {
340 self::$base_lang = $lang_code;
344 $this->translations_repository->store(
345 $transl->withBaseLanguage($lang_code)
349 case 'service_settings':
361 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
363 if (in_array($rec[
'Setting'], $settings)) {
370 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
371 $dir = str_replace(
'..',
'', $rec[
'Dir']);
372 if ($dir !=
'' && $this->getImportDirectory() !=
'') {
373 $source_dir = $this->getImportDirectory() .
'/' . $dir;
375 $customIconFactory =
$DIC[
'object.customicons.factory'];
377 $customIcon->createFromImportDir($source_dir);
382 $new_id = (
int) $this->getNewObjId($mapping, $rec[
'ObjId']);
383 $dir = str_replace(
'..',
'', $rec[
'Dir']);
384 if ($new_id > 0 && $dir !=
'' && $this->getImportDirectory() !=
'') {
385 $source_dir = $this->getImportDirectory() .
'/' . $dir;
386 $object_properties = $this->properties_aggregator->getFor($new_id);
387 $ti = $object_properties->getPropertyTileImage()->getTileImage();
388 $ti->createFromImportDir($source_dir);
389 $object_properties->storePropertyTileImage(
390 $object_properties->getPropertyTileImage()->withTileImage($ti)
402 $objDefinition =
$DIC[
'objDefinition'];
404 $new_id = $mapping->
getMapping(
'components/ILIAS/Container',
'objs', $old_id);
406 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'objs', $old_id);
409 $new_id = $mapping->
getMapping(
'components/ILIAS/ILIASObject',
'obj', $old_id);
413 if (substr($k, 0, 17) ==
'components/ILIAS/') {
414 foreach ($m as $type => $map) {
416 if ($objDefinition->isRBACObject($type)) {
417 $new_id = $mapping->
getMapping($k, $type, $old_id);
424 return (
int) $new_id;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ResourceIdentification.
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
getXmlNamespace(string $entity, string $schema_version)
copyTileToTempFolderForExport(ResourceIdentification $rid)
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