19declare(strict_types=1);
35 protected \ILIAS\Help\GuidedTour\UserFinished\UserFinishedManager
$finish_manager;
36 protected \ILIAS\Help\GuidedTour\Tour\TourManager
$tm;
39 protected \
ILIAS\Help\GuidedTour\InternalDataService
$data,
40 protected \
ILIAS\Help\GuidedTour\InternalDomainService $domain,
41 protected \
ILIAS\Help\GuidedTour\InternalGUIService $gui,
42 protected bool $edit =
false
44 $ctrl = $this->gui->ctrl();
45 $this->tm = $domain->tour();
46 $ctrl->saveParameterByClass(self::class,
"tour_id");
47 $this->step_manager = $domain->step();
48 $this->finish_manager = $domain->userFinished();
53 $ctrl = $this->gui->ctrl();
54 $mt = $this->gui->ui()->mainTemplate();
56 $next_class = $ctrl->getNextClass($this);
57 $cmd = $ctrl->getCmd(
"listTours");
59 switch ($next_class) {
60 case strtolower(ilExportGUI::class):
63 $tour_id = $this->gui->standardRequest()->getTourId();
64 $exp_gui =
new ilExportGUI($this->gui->objectGUI($tour_id));
65 $exp_gui->addFormat(
"xml");
66 $ctrl->forwardCommand($exp_gui);
69 case strtolower(ilGuidedTourPageGUI::class):
70 $mt = $this->gui->mainTemplate();
71 $lng = $this->domain->lng();
73 $mt->setOnScreenMessage(
"info",
$lng->txt(
"gdtr_edit_page_info"));
74 $ctrl->setReturnByClass(self::class,
"listSteps");
75 $ctrl->saveParameterByClass(self::class,
"step_id");
77 $mt->setContent($ret);
80 case strtolower(ilRepoStandardUploadHandlerGUI::class):
82 $gui = $form->getRepoStandardUploadHandlerGUI(
"import");
83 $ctrl->forwardCommand($gui);
103 "confirmStepDeletion",
116 $tabs = $this->gui->tabs();
117 $lng = $this->domain->lng();
118 $ctrl = $this->gui->ctrl();
119 $tabs->clearTargets();
120 $this->gui->help()->setScreenIdComponent(
"hlps_gdtr");
121 $tabs->setBackTarget(
122 $lng->txt(
"gdtr_guided_tours"),
123 $ctrl->getLinkTargetByClass(self::class,
"listTours")
125 $ctrl->saveParameterByClass(self::class,
"tour_id");
128 $lng->txt(
"gdtr_tour_steps"),
129 $ctrl->getLinkTargetByClass(self::class,
"listSteps")
133 $lng->txt(
"settings"),
134 $ctrl->getLinkTargetByClass(self::class,
"editSettings")
139 $ctrl->getLinkTargetByClass(ilexportGUI::class,
"export",
""),
141 $tabs->activateTab($active);
146 $tabs = $this->gui->tabs();
147 $lng = $this->domain->lng();
148 $ctrl = $this->gui->ctrl();
149 $step_id = $this->gui->standardRequest()->getStepId();
150 $tour_id = $this->gui->standardRequest()->getTourId();
152 $tabs->clearTargets();
154 $tabs->setBackTarget(
156 $ctrl->getLinkTargetByClass(ilGuidedTourPageGUI::class,
"edit")
164 $new_page_object->setParentId($tour_id);
165 $new_page_object->setId($step_id);
166 $new_page_object->createFromXML();
174 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
175 $page_gui->setFileDownloadLink(
"");
176 $page_gui->setPresentationTitle(
"");
177 $page_gui->setTemplateOutput(
false);
182 return $ctrl->forwardCommand($page_gui);
188 $mt = $this->gui->ui()->mainTemplate();
189 $f = $this->gui->ui()->factory();
190 $r = $this->gui->ui()->renderer();
192 $ctrl = $this->gui->ctrl();
193 $lng = $this->domain->lng();
195 $mt->setOnScreenMessage(
"info",
$lng->txt(
"gdtr_list_tours_mess"));
198 $b =
$f->button()->standard(
199 $lng->txt(
"gdtr_add_tour"),
200 $ctrl->getLinkTarget($this,
"addTour")
202 $this->gui->toolbar()->addComponent(
$b);
203 $b =
$f->button()->standard(
204 $lng->txt(
"gdtr_import_tour"),
205 $ctrl->getLinkTarget($this,
"importTourForm")
207 $this->gui->toolbar()->addComponent(
$b);
212 foreach ($this->tm->getAll() as $tour) {
213 $ctrl->setParameterByClass(self::class,
"tour_id", $tour->getId());
215 $actions[] =
$f->link()->standard(
216 $lng->txt(
"gdtr_edit_steps"),
217 $ctrl->getLinkTargetByClass(self::class,
"listSteps")
219 $actions[] =
$f->link()->standard(
220 $lng->txt(
"gdtr_tour_settings"),
221 $ctrl->getLinkTargetByClass(self::class,
"editSettings")
224 $actions[] =
$f->button()->shy(
225 $lng->txt(
"gdtr_reset_tour"),
227 )->withOnClick($reset_modal->getShowSignal());
228 $ui_items[] = $reset_modal;
230 $actions[] =
$f->button()->shy(
231 $lng->txt(
"gdtr_delete_tour"),
233 )->withOnClick($delete_modal->getShowSignal());
234 $ui_items[] = $delete_modal;
236 $settings = $this->domain->tourSettings()->getByObjId($tour->getId());
237 $properties[
$lng->txt(
"active")] = $settings?->isActive()
243 $items[] =
$f->item()->standard($tour->getTitle())
244 ->withActions(
$f->dropdown()->standard($actions))
245 ->withProperties($properties);
247 if (count($items) > 0) {
248 $grp =
$f->item()->group(
"", $items);
249 $panel =
$f->panel()->listing()->standard(
250 $lng->txt(
"gdtr_guided_tours"),
253 $ui_items[] = $panel;
254 $mt->setContent($r->render($ui_items));
260 $tour = $this->tm->getByObjId($tour_id);
261 $f = $this->gui->ui()->factory();
262 $r = $this->gui->ui()->renderer();
263 $lng = $this->domain->lng();
264 $ctrl = $this->gui->ctrl();
266 $res_items[] =
$f->modal()->interruptiveItem()->keyValue(
271 $ctrl->setParameterByClass(self::class,
"tour_id", $tour_id);
272 $action = $ctrl->getLinkTargetByClass(self::class,
"resetTour");
274 return $f->modal()->interruptive(
275 $lng->txt(
"gdtr_reset_tour"),
276 $lng->txt(
"gdtr_reset_tour_mess"),
278 )->withAffectedItems($res_items)
279 ->withActionButtonLabel(
$lng->txt(
"gdtr_reset_tour"));
287 $mt = $this->gui->ui()->mainTemplate();
288 $lng = $this->domain->lng();
289 $ctrl = $this->gui->ctrl();
290 $tour_id = $this->gui->standardRequest()->getTourId();
291 $this->finish_manager->resetTour($tour_id);
292 $mt->setOnScreenMessage(
"success",
$lng->txt(
"gdtr_tour_has_been_reset"),
true);
293 $ctrl->redirectByClass(self::class,
"listTours");
298 $tour = $this->tm->getByObjId($tour_id);
299 $f = $this->gui->ui()->factory();
300 $r = $this->gui->ui()->renderer();
301 $lng = $this->domain->lng();
302 $ctrl = $this->gui->ctrl();
304 $del_items[] =
$f->modal()->interruptiveItem()->keyValue(
309 $ctrl->setParameterByClass(self::class,
"tour_id", $tour_id);
310 $action = $ctrl->getLinkTargetByClass(self::class,
"deleteTour");
312 return $f->modal()->interruptive(
313 $lng->txt(
"gdtr_delete_tour"),
314 $lng->txt(
"gdtr_delete_tour_mess"),
316 )->withAffectedItems($del_items);
324 $mt = $this->gui->ui()->mainTemplate();
325 $lng = $this->domain->lng();
326 $ctrl = $this->gui->ctrl();
327 $tour_id = $this->gui->standardRequest()->getTourId();
328 $this->tm->deleteTour($tour_id);
329 $mt->setOnScreenMessage(
"success",
$lng->txt(
"gdtr_deleted_tour"),
true);
330 $ctrl->redirectByClass(self::class,
"listTours");
335 $lng = $this->domain->lng();
336 return $this->gui->form([self::class],
"saveTour")
337 ->section(
"sec",
$lng->txt(
"gdtr_add_tour"))
338 ->addStdTitleAndDescription(0,
"gdtr");
343 $mt = $this->gui->ui()->mainTemplate();
352 $mt = $this->gui->ui()->mainTemplate();
353 $lng = $this->domain->lng();
354 $ctrl = $this->gui->ctrl();
356 if ($form->isValid()) {
357 $obj_id = $this->tm->createTour(
"dummy",
"");
358 $form->saveStdTitleAndDescription($obj_id,
"gdtr");
359 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
360 $ctrl->redirectByClass(self::class,
"listTours");
362 $mt->setContent($form->render());
370 $mt = $this->gui->ui()->mainTemplate();
376 $tour_id = $this->gui->standardRequest()->getTourId();
377 $lng = $this->domain->lng();
378 $settings = $this->domain->tourSettings()->getByObjId($tour_id);
379 $perm_val = (string) $settings?->getPermission()->value;
380 if ($perm_val ===
"0") {
384 $lang_vals = $this->domain->tourSettings()->getLangOptions($lang_val);
385 if ($perm_val ===
"0") {
390 ->form([self::class],
"saveSettings")
391 ->section(
"sec",
$lng->txt(
"settings"))
395 $lng->txt(
"gdtr_active"),
397 $settings?->isActive()
399 ->section(
"sec2",
$lng->txt(
"gdtr_presentation_limitation"))
402 $lng->txt(
"gdtr_screen_ids"),
403 $lng->txt(
"gdtr_screen_ids_info"),
404 $settings?->getScreenIds()
408 $lng->txt(
"gdtr_permission"),
410 (string) PermissionType::Read->value =>
$lng->txt(
"read"),
411 (string) PermissionType::Write->value =>
$lng->txt(
"write"),
414 $lng->txt(
"gdtr_permission_info"),
419 $lng->txt(
"gdtr_language"),
421 $lng->txt(
"gdtr_language_info"),
432 $mt = $this->gui->ui()->mainTemplate();
434 $tour_id = $this->gui->standardRequest()->getTourId();
435 $lng = $this->domain->lng();
436 $ctrl = $this->gui->ctrl();
438 $tour_settings = $this->domain->tourSettings();
439 if ($form->isValid()) {
440 $form->saveStdTitleAndDescription($tour_id,
"gdtr");
441 $tour_settings->save($this->data->settings(
443 (
bool) $form->getData(
"active"),
444 $form->getData(
"screen_ids"),
446 $form->getData(
"lang")
448 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
449 $ctrl->redirectByClass(self::class,
"editSettings");
451 $mt->setContent($form->render());
458 $tabs = $this->gui->tabs();
459 $lng = $this->domain->lng();
460 $mt = $this->gui->ui()->mainTemplate();
461 $ctrl = $this->gui->ctrl();
462 $tour = $this->tm->getByObjId($this->gui->standardRequest()->getTourId());
463 $mt->setTitle(
$lng->txt(
"guided_tour") .
": " . $tour?->getTitle());
464 $mt->setDescription($tour?->getDescription());
465 $tabs->clearTargets();
466 $tabs->setBackTarget(
468 $ctrl->getLinkTargetByClass(self::class,
"listTours")
475 $tabs = $this->gui->tabs();
476 $lng = $this->domain->lng();
477 $ctrl = $this->gui->ctrl();
478 $tabs->setBackTarget(
480 $ctrl->getLinkTargetByClass(self::class,
"listSteps")
486 $mt = $this->gui->ui()->mainTemplate();
487 $f = $this->gui->ui()->factory();
488 $ctrl = $this->gui->ctrl();
489 $lng = $this->domain->lng();
492 if ($table->handleCommand()) {
499 $b =
$f->button()->standard(
500 $lng->txt(
"gdtr_add_step"),
501 $ctrl->getLinkTarget($this,
"addStep")
503 $this->gui->toolbar()->addComponent(
$b);
505 $mt->setContent($table->render());
510 return $this->gui->stepTableGUI(
511 $this->gui->standardRequest()->getTourId(),
527 $mt = $this->gui->ui()->mainTemplate();
528 $lng = $this->domain->lng();
529 $mt->setOnScreenMessage(
"info",
$lng->txt(
"gdtr_edit_step_info"));
535 $lng = $this->domain->lng();
536 $type_val = (string) $step?->getType()->value;
537 $mb_element_id = $step?->getType()->value === StepType::Mainbar->value
538 ? $step?->getElementId()
540 $mt_element_id = $step?->getType()->value === StepType::Metabar->value
541 ? $step?->getElementId()
543 $tab_element_id = $step?->getType()->value === StepType::Tab->value
544 ? $step?->getElementId()
546 return $this->gui->form([self::class],
"saveStep")
547 ->section(
"sec",
$lng->txt(
"gdtr_step"))
548 ->
switch(
"type",
$lng->txt(
"gdtr_step_type"),
"", $type_val)
549 ->group((
string) StepType::Mainbar->value,
$lng->txt(
"gdtr_mainbar"),
$lng->txt(
"gdtr_mainbar_info"))
550 ->text(
"mb_element_id",
$lng->txt(
"gdtr_element_id"),
"", $mb_element_id)
551 ->group((
string) StepType::Metabar->value,
$lng->txt(
"gdtr_metabar"),
$lng->txt(
"gdtr_metabar_info"))
552 ->text(
"mt_element_id",
$lng->txt(
"gdtr_element_id"),
"", $mt_element_id)
553 ->group((
string) StepType::Tab->value,
$lng->txt(
"gdtr_tabs"),
$lng->txt(
"gdtr_tabs_info"))
554 ->text(
"tab_element_id",
$lng->txt(
"gdtr_element_id"),
"", $tab_element_id)
555 ->group((
string) StepType::Form->value,
$lng->txt(
"gdtr_form"),
$lng->txt(
"gdtr_form_info"))
556 ->group((
string) StepType::Table->value,
$lng->txt(
"gdtr_table"),
$lng->txt(
"gdtr_table_info"))
557 ->group((
string) StepType::Toolbar->value,
$lng->txt(
"gdtr_toolbar"),
$lng->txt(
"gdtr_toolbar_info"))
567 $ctrl = $this->gui->ctrl();
568 $mt = $this->gui->ui()->mainTemplate();
570 if (($step_id = $this->gui->standardRequest()->getStepId()) > 0) {
571 $step = $this->step_manager->getById($step_id);
572 $oder_nr = $step->getOrderNr();
575 if ($form->isValid()) {
576 $element_id = match ((
int) $form->getData(
"type")) {
577 StepType::Mainbar->value => $form->getData(
"mb_element_id"),
578 StepType::Metabar->value => $form->getData(
"mt_element_id"),
579 StepType::Tab->value => $form->getData(
"tab_element_id"),
582 $step = $this->data->step(
584 $this->gui->standardRequest()->getTourId(),
590 $this->step_manager->update($step);
591 $ctrl->redirectByClass(self::class,
"listSteps");
593 $new_id = $this->step_manager->create($step);
594 $ctrl->setParameterByClass(self::class,
"step_id", $new_id);
595 $ctrl->redirectByClass(ilGuidedTourPageGUI::class,
"edit");
598 $mt->setContent($form->render());
604 $mt = $this->gui->mainTemplate();
605 $lng = $this->domain->lng();
607 $mt->setOnScreenMessage(
"info",
$lng->txt(
"gdtr_edit_step_info"));
608 $ctrl = $this->gui->ctrl();
609 $ctrl->setParameterByClass(self::class,
"step_id", $step_id);
610 $step = $this->step_manager->getById($step_id);
612 $mt->setContent($form->render());
620 $ctrl = $this->gui->ctrl();
621 $ctrl->setParameterByClass(self::class,
"step_id", $step_id);
622 $ctrl->redirectByClass(ilGuidedTourPageGUI::class,
"edit");
627 $tabs = $this->gui->tabs();
628 $lng = $this->domain->lng();
629 $ctrl = $this->gui->ctrl();
632 $lng->txt(
"gdtr_tours"),
633 $ctrl->getLinkTargetByClass(self::class,
"listTours")
637 $lng->txt(
"gdtr_id_settings"),
638 $ctrl->getLinkTargetByClass(self::class,
"idSettings")
640 $tabs->activateSubTab($active);
646 $mt = $this->gui->ui()->mainTemplate();
647 $mt->setContent($this->
getIdForm()->render());
652 $lng = $this->domain->lng();
653 $id_pres = $this->domain->idPresentation();
656 ->form([self::class],
"saveIdSettings")
657 ->section(
"sec",
$lng->txt(
"gdtr_id_settings"))
660 $lng->txt(
"gdtr_id_pres_users"),
661 $lng->txt(
"gdtr_id_pres_users_info"),
662 $id_pres->getIdPresentationUsers()
665 $form = $form->disabled();
672 $mt = $this->gui->ui()->mainTemplate();
673 $lng = $this->domain->lng();
674 $ctrl = $this->gui->ctrl();
677 $id_pres = $this->domain->idPresentation();
678 $id_pres->saveIdPresentationUsers($form->getData(
"users"));
679 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
681 $ctrl->redirectByClass(self::class,
"idSettings");
689 $ctrl = $this->gui->ctrl();
690 $mt = $this->gui->ui()->mainTemplate();
691 $lng = $this->domain->lng();
692 $ctrl->saveParameterByClass(self::class,
"tour_id");
695 $data = $table->getData();
696 if (is_array(
$data)) {
697 $this->step_manager->saveOrder(
698 $this->gui->standardRequest()->getTourId(),
701 $mt->setOnScreenMessage(
"success",
$lng->txt(
"msg_obj_modified"),
true);
703 $ctrl->redirectByClass(self::class,
"listSteps");
708 $lng = $this->domain->lng();
709 $ctrl = $this->gui->ctrl();
711 $step = $this->step_manager->getById($step_id);
712 $ctrl->setParameterByClass(self::class,
"step_id", $step_id);
713 $title = $this->step_manager->getStepName($step->getType());
714 if ($step->getElementId() !==
"") {
715 $title .=
" (" . $step->getElementId() .
")";
717 $table->renderDeletionConfirmation(
718 $lng->txt(
"gdtr_delete_step"),
719 $lng->txt(
"gdtr_delete_step_mess"),
732 $ctrl = $this->gui->ctrl();
733 $mt = $this->gui->ui()->mainTemplate();
734 $lng = $this->domain->lng();
735 $tour_id = $this->gui->standardRequest()->getTourId();
736 $step_id = $this->gui->standardRequest()->getStepId();
738 $this->step_manager->delete($tour_id, $step_id);
739 $mt->setOnScreenMessage(
"success",
$lng->txt(
"gdtr_deleted_step"),
true);
740 $ctrl->redirectByClass(self::class,
"listSteps");
745 $mt = $this->gui->ui()->mainTemplate();
751 $lng = $this->domain->lng();
752 return $this->gui->form([self::class],
"importTour")
753 ->section(
"sec",
$lng->txt(
"gdtr_import_tour"))
756 $lng->txt(
"import_file"),
757 $this->handleImportUpload(...),
791 if ($fname[4] ==
"gdtr") {
793 $new_id = $imp->importObject(
807 $ctrl = $this->gui->ctrl();
808 $ctrl->redirectByClass(self::class,
"listTours");
Class BasicHandlerResult.
Export User Interface Class.
@ilCtrl_Calls ilGuidedTourAdminGUI: ilGuidedTourPageGUI, ilExportGUI, ilRepoStandardUploadHandlerGUI
ILIAS Help GuidedTour Step StepManager $step_manager
setSubTabs(string $active)
__construct(protected \ILIAS\Help\GuidedTour\InternalDataService $data, protected \ILIAS\Help\GuidedTour\InternalDomainService $domain, protected \ILIAS\Help\GuidedTour\InternalGUIService $gui, protected bool $edit=false)
importTourFile(string $filename, string $path)
getDeleteTourModal(int $tour_id)
getStepForm(?Step $step=null)
ILIAS Help GuidedTour UserFinished UserFinishedManager $finish_manager
setSettingsTabs(string $active)
getResetTourModal(int $tour_id)
confirmStepDeletion(int $step_id)
ILIAS Help GuidedTour Tour TourManager $tm
handleImportUpload(FileUpload $upload, UploadResult $result)
@ilCtrl_Calls ilGuidedTourPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls i...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.