ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
IdentifierHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29
31{
33 protected PathFactory $path_factory;
34
35 public function __construct(
37 PathFactory $path_factory
38 ) {
39 $this->manipulator = $manipulator;
40 $this->path_factory = $path_factory;
41 }
42
44 SetInterface $set,
45 RessourceIDInterface $ressource_id
46 ): SetInterface {
47 $set = $this->manipulator->prepareCreateOrUpdate(
48 $set,
50 $this->generateIdentifierEntry($ressource_id)
51 );
52 $set = $this->manipulator->prepareCreateOrUpdate(
53 $set,
56 );
57 return $set;
58 }
59
60 protected function generateIdentifierEntry(RessourceIDInterface $ressource_id): string
61 {
62 $numeric_id = $ressource_id->subID() !== 0 ?
63 $ressource_id->subID() :
64 $ressource_id->objID();
65
66 return 'il_' . $this->getInstallID() . '_' . $ressource_id->type() . '_' . $numeric_id;
67 }
68
69 protected function generateIdentifierCatalog(): string
70 {
71 return 'ILIAS';
72 }
73
75 {
76 return $this->path_factory
77 ->custom()
78 ->withNextStep('general')
79 ->withNextStep('identifier')
80 ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, '0')
81 ->withNextStep('entry')
82 ->get();
83 }
84
86 {
87 return $this->path_factory
88 ->custom()
89 ->withNextStep('general')
90 ->withNextStep('identifier')
91 ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, '0')
92 ->withNextStep('catalog')
93 ->get();
94 }
95
96 protected function getInstallID(): string
97 {
98 return (string) IL_INST_ID;
99 }
100}
prepareUpdateOfIdentifier(SetInterface $set, RessourceIDInterface $ressource_id)
__construct(ManipulatorInterface $manipulator, PathFactory $path_factory)
const IL_INST_ID
Definition: constants.php:40
objID()
Object ID (NOT ref_id!) of the parent repository object (e.g for page objects the obj_id of the conte...
type()
(Sub-)Type of the object (e.g st,pg,crs ...) NOTE: In the metadata tables, this corresponds to the fi...
subID()
ID of the object carrying the metadata, which might be a subobject of an enclosing repository object ...
FilterType
Values should always be all lowercase.
Definition: FilterType.php:27