19 declare(strict_types=1);
70 public function __construct(
int $obj_id,
int $sub_id,
string $type)
78 $this->
ctrl = $services->dic()->ctrl();
79 $this->tpl = $services->dic()->ui()->mainTemplate();
80 $this->ui_renderer = $services->dic()->ui()->renderer();
81 $this->presenter = $services->editor()->presenter();
82 $this->request_parser = $services->editor()->requestParser();
83 $this->
repository = $services->repository()->repository();
84 $this->observer_handler = $services->editor()->observerHandler();
85 $this->
access = $services->dic()->access();
86 $this->
toolbar = $services->dic()->toolbar();
87 $this->global_screen = $services->dic()->globalScreen();
88 $this->
tabs = $services->dic()->tabs();
89 $this->ui_factory = $services->dic()->ui()->factory();
98 $next_class = $this->
ctrl->getNextClass($this);
100 $cmd = $this->
ctrl->getCmd();
101 switch ($next_class) {
104 $cmd =
"listQuickEdit";
113 $xml_writer =
new ilMD2XML($this->obj_id, $this->sub_id, $this->type);
114 $xml_writer->startExport();
118 $this->tpl->setContent($button . htmlentities($xml_writer->getXML()));
129 $digest = $this->digest_initiator->init();
143 $digest = $this->digest_initiator->init();
150 $request = $this->request_parser->fetchRequestForForm(
false);
151 if (!$digest->updateMD($set, $request)) {
152 $this->tpl->setOnScreenMessage(
154 $this->presenter->utilities()->txt(
'msg_form_save_error'),
167 $this->tpl->setOnScreenMessage(
169 $this->presenter->utilities()->txt(
"saved_successfully"),
172 $this->
ctrl->redirect($this,
'listQuickEdit');
180 $content = $digest->
getContent($set, $request);
181 $template_content = [];
182 foreach ($content as $type => $entity) {
184 case DigestContentType::FORM:
186 $template_content[] = $entity;
189 case DigestContentType::JS_SOURCE:
190 $this->tpl->addJavaScript($entity);
194 $this->tpl->setContent(
196 $this->ui_renderer->render($template_content)
215 $base_path = $this->request_parser->fetchBasePath();
216 $action_path = $this->request_parser->fetchActionPath();
224 $editor = $this->full_editor_initiator->init();
225 $set = $editor->manipulateMD()->prepare($set, $base_path);
228 $request = $this->request_parser->fetchRequestForForm(
true);
229 $success = $editor->manipulateMD()->createOrUpdate(
236 $this->tpl->setOnScreenMessage(
238 $this->presenter->utilities()->txt(
'msg_form_save_error'),
246 $this->observer_handler->callObserversByPath($action_path);
249 $this->tpl->setOnScreenMessage(
251 $this->presenter->utilities()->txt(
253 'meta_add_element_success' :
254 'meta_edit_element_success' 258 $this->
ctrl->setParameter(
260 Parameter::BASE_PATH->value,
261 urlencode($base_path->toString())
263 $this->
ctrl->redirect($this,
'fullEditor');
271 $base_path = $this->request_parser->fetchBasePath();
272 $delete_path = $this->request_parser->fetchActionPath();
280 $editor = $this->full_editor_initiator->init();
283 $base_path = $editor->manipulateMD()->deleteAndTrimBasePath(
290 $this->observer_handler->callObserversByPath($delete_path);
293 $this->tpl->setOnScreenMessage(
295 $this->presenter->utilities()->txt(
'meta_delete_element_success'),
298 $this->
ctrl->setParameter(
300 Parameter::BASE_PATH->value,
301 urlencode($base_path->toString())
303 $this->
ctrl->redirect($this,
'fullEditor');
311 $base_path = $this->request_parser->fetchBasePath();
319 $editor = $this->full_editor_initiator->init();
320 $set = $editor->manipulateMD()->prepare($set, $base_path);
333 $this->global_screen->tool()->context()->current()->addAdditionalData(
337 $this->global_screen->tool()->context()->current()->addAdditionalData(
343 $content = $full_editor->
getContent($set, $base_path, $request);
344 $template_content = [];
345 foreach ($content as $type => $entity) {
347 case FullContentType::MAIN:
348 if ($entity instanceof
Table) {
349 $entity = $this->ui_factory->legacy(
353 $template_content[] = $entity;
357 if ($modal = $entity->getModal()) {
358 $template_content[] = $modal;
362 case FullContentType::TOOLBAR:
363 $this->
toolbar->addComponent($entity);
367 $this->tpl->setContent($this->ui_renderer->render($template_content));
372 $this->
tabs->clearSubTabs();
373 foreach ($this->
tabs->target as $tab) {
374 if (($tab[
'id'] ?? null) !== $this->
tabs->getActiveTab()) {
375 $this->
tabs->removeTab($tab[
'id']);
378 $this->
tabs->removeNonTabbedLinks();
379 $this->
tabs->setBackTarget(
380 $this->presenter->utilities()->txt(
'back'),
381 $this->
ctrl->getLinkTarget($this,
'listQuickEdit')
387 $bulky = $this->ui_factory->button()->bulky(
388 $this->ui_factory->symbol()->icon()->standard(
390 $this->presenter->utilities()->txt(
'meta_button_to_full_editor_label'),
393 $this->presenter->utilities()->txt(
'meta_button_to_full_editor_label'),
394 $this->
ctrl->getLinkTarget($this,
'fullEditor')
397 $debug = $this->ui_factory->button()->bulky(
398 $this->ui_factory->symbol()->icon()->standard(
403 $this->
ctrl->getLinkTarget($this,
'debug')
406 return $this->ui_renderer->render($bulky) .
407 (isset($debug) ?
'</p>' . $this->ui_renderer->render($debug) :
'');
413 if ($this->obj_id === 0) {
418 if (empty($ref_ids)) {
421 foreach ($ref_ids as
$ref_id) {
422 if ($this->
access->checkAccess(
436 public function addObserver(
object $a_class,
string $a_method,
string $a_element): void
438 $this->observer_handler->addObserver($a_class, $a_method, $a_element);
443 $this->observer_handler->callObservers($a_element);
ObserverHandler $observer_handler
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
DigestInitiator $digest_initiator
static _getAllReferences(int $id)
get all reference ids for object ID
renderDigest(SetInterface $set, Digest $digest, ?RequestForFormInterface $request=null)
RequestParserInterface $request_parser
renderButtonToFullEditor()
FullEditorInitiator $full_editor_initiator
PresenterInterface $presenter
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
RepositoryInterface $repository
callListeners(string $a_element)
renderFullEditor(SetInterface $set, PathInterface $base_path, FullEditor $full_editor, ?RequestForFormInterface $request=null)
addObserver(object $a_class, string $a_method, string $a_element)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GlobalScreen $global_screen
__construct(int $obj_id, int $sub_id, string $type)
fullEditorEdit(bool $create)