ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
Services.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\DI\Container as GlobalContainer;
24use ILIAS\MetaData\Presentation\Services\Services as PresentationServices;
25use ILIAS\MetaData\Copyright\Services\Services as CopyrightServices;
27use ILIAS\MetaData\Repository\Services\Services as RepositoryServices;
38use ILIAS\Export\ExportHandler\Factory as ExportService;
39use ILIAS\Data\Factory as DataFactory;
46use ILIAS\MetaData\OERHarvester\ControlCenter\ComponentFactoryInterface as ControlCenterComponentFactoryInterface;
47use ILIAS\MetaData\OERHarvester\ControlCenter\ComponentFactory as ControlCenterComponentFactory;
51
53{
55 protected ExposedRecordsRepository $exposed_records_repository;
57 protected ControlCenterComponentFactoryInterface $control_center_component_factory;
59
61 protected ObjectHandler $repository_object_handler;
63 protected StatusRepository $status_repository;
65
66 public function __construct(
67 protected GlobalContainer $dic,
68 protected PresentationServices $presentation_services,
69 protected CopyrightServices $copyright_services,
70 protected PathServices $path_services,
71 protected RepositoryServices $repository_services,
72 protected XMLServices $xml_services
73 ) {
74 }
75
76 public function settings(): SettingsInterface
77 {
78 return $this->settings ??= new Settings();
79 }
80
81 public function exposedRecordsRepository(): ExposedRecordsRepository
82 {
83 return $this->exposed_records_repository ??= new ExposedRecordsRepository($this->dic->database());
84 }
85
86 public function controlCenterGUI(string $link_to_parent): ControlCenterGUI
87 {
88 $data_factory = new DataFactory();
89 $link_to_parent = $data_factory->uri(
90 rtrim(ILIAS_HTTP_PATH, '/') . '/' .
91 ltrim($link_to_parent, '/')
92 );
93
94 return $this->control_center_gui ??= new ControlCenterGUI(
95 $link_to_parent,
96 $this->dic->ctrl(),
97 $this->dic->ui()->mainTemplate(),
98 $this->dic->ui()->factory(),
99 $this->dic->ui()->renderer(),
100 new RequestParser(
101 $this->dic->http(),
102 $this->dic->refinery()
103 ),
104 new ContentFactory(
105 $this->dic->ui()->factory(),
106 $this->presentation_services->utilities(),
107 $this->linkFactory(),
108 $this->copyright_services->repository()
109 ),
110 $this->presentation_services->utilities(),
111 $this->stateInfoFetcher(),
112 $this->publisher(),
113 $this->settings(),
114 $this->dic['static_url'],
115 $data_factory,
116 $this->repositoryObjectHandler()
117 );
118 }
119
121 {
122 return $this->state_info_fetcher ??= new StateInfoFetcher(
123 $this->dic->access(),
124 $this->exposedRecordsRepository(),
125 $this->statusRepository(),
126 $this->settings(),
127 $this->repositoryObjectHandler(),
128 $this->copyright_services->identifiersHandler(),
129 $this->publisher(),
130 $this->repository_services->repository(),
131 $this->path_services->navigatorFactory(),
132 $this->path_services->pathFactory()
133 );
134 }
135
136 public function controlCenterComponentFactory(): ControlCenterComponentFactoryInterface
137 {
138 return $this->control_center_component_factory ??= new ControlCenterComponentFactory(
139 $this->dic->ui()->factory(),
140 new DataFactory(),
141 $this->linkFactory(),
142 $this->presentation_services->utilities()
143 );
144 }
145
147 {
148 return new AutomaticPublisher(
149 $this->publisher(),
150 $this->settings(),
152 $this->statusRepository(),
154 $this->copyright_services->searcherFactory(),
155 $this->repository_services->repository(),
156 $this->XMLWriter(),
157 $this->dic->logger()->meta()
158 );
159 }
160
161 protected function linkFactory(): LinkFactoryInterface
162 {
163 return $this->link_factory ??= new LinkFactory(
164 $this->dic->ctrl()
165 );
166 }
167
168 protected function repositoryObjectHandler(): ObjectHandler
169 {
170 return $this->repository_object_handler ??= new ObjectHandler($this->dic->repositoryTree());
171 }
172
173 protected function XMLWriter(): Writer
174 {
175 return $this->xml_writer ??= new Writer(
176 $this->repository_services->repository(),
177 $this->xml_services->simpleDCWriter()
178 );
179 }
180
181 protected function statusRepository(): StatusRepository
182 {
183 return $this->status_repository ??= new DatabaseRepository($this->dic->database());
184 }
185
186 protected function publisher(): PublisherInterface
187 {
188 return $this->publisher ??= new Publisher(
190 $this->statusRepository(),
192 new ExportHandler(
193 $this->dic->user(),
194 new ExportService(), // should be replaced by proper API
195 new DataFactory()
196 ),
197 $this->settings(),
198 $this->XMLWriter(),
199 $this->dic->access()
200 );
201 }
202}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds data types.
Definition: Factory.php:36
__construct(protected GlobalContainer $dic, protected PresentationServices $presentation_services, protected CopyrightServices $copyright_services, protected PathServices $path_services, protected RepositoryServices $repository_services, protected XMLServices $xml_services)
Definition: Services.php:66
ControlCenterComponentFactoryInterface $control_center_component_factory
Definition: Services.php:57
controlCenterGUI(string $link_to_parent)
Definition: Services.php:86
StateInfoFetcherInterface $state_info_fetcher
Definition: Services.php:56
ExposedRecordsRepository $exposed_records_repository
Definition: Services.php:55
$dic
Definition: ltiresult.php:33