19declare(strict_types=1);
86 $this->full_editor_services = $services->editor()->fullEditor();
87 $this->digest_services = $services->editor()->digest();
88 $this->publishing_services = $services->OERHarvester();
90 $this->
ctrl = $services->dic()->ctrl();
91 $this->tpl = $services->dic()->ui()->mainTemplate();
92 $this->ui_renderer = $services->dic()->ui()->renderer();
93 $this->presenter = $services->editor()->internal()->presenter();
94 $this->request_parser = $services->editor()->internal()->requestParser();
95 $this->
repository = $services->repository()->repository();
96 $this->observer_handler = $services->editor()->internal()->observerHandler();
97 $this->
access = $services->dic()->access();
98 $this->
toolbar = $services->dic()->toolbar();
99 $this->global_screen = $services->dic()->globalScreen();
100 $this->
tabs = $services->dic()->tabs();
101 $this->ui_factory = $services->dic()->ui()->factory();
102 $this->xml_writer = $services->xml()->standardWriter();
112 $next_class = $this->
ctrl->getNextClass($this);
114 $cmd = $this->
ctrl->getCmd();
115 switch ($next_class) {
116 case strtolower(ControlCenterGUI::class):
117 $back_link = $this->
ctrl->getLinkTarget($this,
'listQuickEdit');
118 $gui = $this->publishing_services->controlCenterGUI($back_link);
119 $this->
ctrl->forwardCommand($gui);
123 $valid_cmd = (Command::tryFrom($cmd) ?? Command::SHOW_DIGEST)->value;
131 $xml = $this->xml_writer->write($this->
repository->getMD($this->obj_id, $this->sub_id, $this->type));
132 $dom =
new DOMDocument(
'1.0');
133 $dom->formatOutput =
true;
134 $dom->preserveWhiteSpace =
false;
135 $dom->loadXML($xml->asXML());
138 $this->tpl->setContent(
'<pre>' . htmlentities($dom->saveXML()) .
'</pre>');
149 $digest = $this->digest_services->digest();
163 $digest = $this->digest_services->digest();
164 $manipulator = $this->digest_services->manipulatorAdapter();
171 $request = $this->request_parser->fetchRequestForForm(
false);
172 if (!$manipulator->update($set, $request)) {
173 $this->tpl->setOnScreenMessage(
175 $this->presenter->utilities()->txt(
'msg_form_save_error'),
188 $this->tpl->setOnScreenMessage(
190 $this->presenter->utilities()->txt(
"saved_successfully"),
193 $this->
ctrl->redirect($this,
'listQuickEdit');
201 $content = $digest->
getContent($set, $request);
203 foreach ($content as
$type => $entity) {
205 case DigestContentType::FORM:
207 $template_content[] = $entity;
210 case DigestContentType::JS_SOURCE:
211 $this->tpl->addJavaScript($entity);
216 $this->tpl->setContent($this->ui_renderer->render($template_content));
221 $this->fullEditorEdit(
true);
226 $this->fullEditorEdit(
false);
231 $this->checkAccess();
234 $base_path = $this->request_parser->fetchBasePath();
235 $action_path = $this->request_parser->fetchActionPath();
243 $editor = $this->full_editor_services->fullEditor();
244 $manipulator = $this->full_editor_services->manipulatorAdapter();
245 $set = $manipulator->prepare($set, $base_path);
248 $request = $this->request_parser->fetchRequestForForm(
true);
249 $success = $manipulator->createOrUpdate(
256 $this->tpl->setOnScreenMessage(
258 $this->presenter->utilities()->txt(
'msg_form_save_error'),
261 $this->renderFullEditor($set, $base_path, $editor, $request);
266 $this->observer_handler->callObserversByPath($action_path);
269 $this->tpl->setOnScreenMessage(
271 $this->presenter->utilities()->txt(
273 'meta_add_element_success' :
274 'meta_edit_element_success'
278 $this->
ctrl->setParameter(
280 Parameter::BASE_PATH->value,
281 urlencode($base_path->toString())
283 $this->
ctrl->redirect($this,
'fullEditor');
288 $this->checkAccess();
291 $base_path = $this->request_parser->fetchBasePath();
292 $delete_path = $this->request_parser->fetchActionPath();
300 $editor = $this->full_editor_services->fullEditor();
301 $manipulator = $this->full_editor_services->manipulatorAdapter();
304 $base_path = $manipulator->deleteAndTrimBasePath(
311 $this->observer_handler->callObserversByPath($delete_path);
314 $this->tpl->setOnScreenMessage(
316 $this->presenter->utilities()->txt(
'meta_delete_element_success'),
319 $this->
ctrl->setParameter(
321 Parameter::BASE_PATH->value,
322 urlencode($base_path->toString())
324 $this->
ctrl->redirect($this,
'fullEditor');
329 $this->setTabsForFullEditor();
332 $base_path = $this->request_parser->fetchBasePath();
340 $editor = $this->full_editor_services->fullEditor();
341 $manipulator = $this->full_editor_services->manipulatorAdapter();
342 $set = $manipulator->prepare($set, $base_path);
345 $this->renderFullEditor($set, $base_path, $editor);
355 $this->global_screen->tool()->context()->current()->addAdditionalData(
359 $this->global_screen->tool()->context()->current()->addAdditionalData(
365 $content = $full_editor->
getContent($set, $base_path, $request);
366 $template_content = [];
367 foreach ($content as $type => $entity) {
369 case FullContentType::MAIN:
370 if ($entity instanceof
Table) {
371 $entity = $this->ui_factory->legacy()->content(
375 $template_content[] = $entity;
379 if ($modal = $entity->getModal()) {
380 $template_content[] = $modal;
384 case FullContentType::TOOLBAR:
385 $this->
toolbar->addComponent($entity);
389 $this->tpl->setContent($this->ui_renderer->render($template_content));
394 $this->
tabs->clearSubTabs();
395 foreach ($this->
tabs->target as $tab) {
396 if (($tab[
'id'] ??
null) !== $this->
tabs->getActiveTab()) {
397 $this->
tabs->removeTab($tab[
'id']);
400 $this->
tabs->removeNonTabbedLinks();
401 $this->
tabs->setBackTarget(
402 $this->presenter->utilities()->txt(
'back'),
403 $this->ctrl->getLinkTarget($this,
'listQuickEdit')
409 $editor = $this->ui_factory->button()->standard(
410 $this->presenter->utilities()->txt(
'meta_button_to_full_editor_label'),
411 $this->ctrl->getLinkTarget($this,
'fullEditor')
413 $this->
toolbar->addComponent($editor);
415 $debug = $this->ui_factory->button()->standard(
417 $this->
ctrl->getLinkTarget($this,
'debug')
419 $this->
toolbar->addComponent($debug);
429 if (!$this->publishing_services->stateInfoFetcher()->isPublishingRelevantForObject(
436 $status = $this->publishing_services->stateInfoFetcher()->getStatusForObject($this->obj_id);
437 return $this->publishing_services->controlCenterComponentFactory()->getButtonToControlCenter(
448 if ($this->obj_id === 0 || $this->ref_id === 0) {
451 if ($this->
access->checkAccess(
464 public function addObserver(
object $a_class,
string $a_method,
string $a_element): void
466 $this->observer_handler->addObserver($a_class, $a_method, $a_element);
471 $this->observer_handler->callObservers($a_element);
Builds a Color from either hex- or rgb values.
Class ilCtrl provides processing control methods.
const string PATH_FOR_TREE
FullEditorServices $full_editor_services
RequestParserInterface $request_parser
fullEditorEdit(bool $create)
GlobalScreen $global_screen
const string SET_FOR_TREE
renderFullEditor(SetInterface $set, PathInterface $base_path, FullEditor $full_editor, ?RequestForFormInterface $request=null)
addObserver(object $a_class, string $a_method, string $a_element)
renderDigest(SetInterface $set, Digest $digest, ?RequestForFormInterface $request=null)
callListeners(string $a_element)
PresenterInterface $presenter
ObserverHandler $observer_handler
ilGlobalTemplateInterface $tpl
PublishingServices $publishing_services
__construct(int $obj_id, int $sub_id, string $type, int $ref_id=0)
DigestServices $digest_services
RepositoryInterface $repository
getButtonToControlCenter()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An entity that renders components to a string output.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...