19declare(strict_types=1);
33 protected \ILIAS\Help\GuidedTour\UserFinished\UserFinishedManager
$finish_manager;
36 protected \ILIAS\Help\GuidedTour\StandardGUIRequest
$request;
40 protected \ILIAS\Help\InternalGUIService
$gui;
41 protected \ILIAS\Help\InternalService
$help;
46 $this->current_screen_id =
$DIC->help()->getScreenId();
47 $this->
help = $DIC->help()->internal();
48 $this->gui = $this->
help->gui();
49 $this->
user = $this->
help->domain()->user();
50 $this->tour_manager = $this->
help->domain()->guidedTour()->tour();
51 $this->step_manager = $this->
help->domain()->guidedTour()->step();
52 $this->page_manager = $this->
help->domain()->guidedTour()->page();
53 $this->settings_manager = $this->
help->domain()->guidedTour()->tourSettings();
54 $this->finish_manager = $this->
help->domain()->guidedTour()->userFinished();
55 $this->request = $this->gui->guidedTour()->standardRequest();
56 $this->
access = $DIC->access();
57 $this->obj_definition = $this->
help->domain()->objectDefinition();
62 $ctrl = $this->gui->ctrl();
64 $next_class = $ctrl->getNextClass($this);
65 $cmd = $ctrl->getCmd();
67 switch ($next_class) {
79 public function init(): void
81 $mt = $this->gui->ui()->mainTemplate();
82 $f = $this->gui->ui()->factory();
83 $r = $this->gui->ui()->renderer();
84 $ctrl = $this->gui->ctrl();
86 if (!$this->tour_manager->anyActive()) {
91 $r->render(
$f->popover()->standard(
$f->legacy()->content(
'')));
94 $mt->addJavaScript(
"assets/js/repository.js");
96 $mt->addJavaScript(
"../components/ILIAS/Help/resources/guided-tour.js");
98 $mt->addJavaScript(
"assets/js/guided-tour.js");
100 $ctrl->setParameterByClass(self::class,
"screen_id", rawurlencode($this->current_screen_id));
101 $ctrl->setParameterByClass(self::class,
"ref_id", (
string) $this->request->getRefId());
102 $target = $ctrl->getLinkTargetByClass(self::class,
"",
"",
true);
103 $mt->addOnloadCode(
"il.guidedTour.init('$target');");
108 if (!$this->tour_manager->anyActive()) {
111 return $link->withAdditionalOnLoadCode(
static function (
string $id) use ($tab_id):
string {
112 return "il.guidedTour.addMapping('$tab_id', '$id');";
118 $f = $this->gui->ui()->factory();
119 $r = $this->gui->ui()->renderer();
120 $ctrl = $this->gui->ctrl();
121 $popover =
$f->popover()->standard(
$f->legacy()->content(
''));
123 $data = new \stdClass();
124 $popoverHtml = $r->renderAsync($popover);
126 $popoverHtml = str_replace(
"JSON.parse('{",
"JSON.parse('{\"trigger\":\"manual\",", $popoverHtml);
127 $data->popoverHtml = $popoverHtml;
128 $data->popoverShowSignal = $popover->getShowSignal()->getId();
130 $ref_id = $this->request->getRefId();
131 foreach ($this->tour_manager->getAll() as $tour) {
132 $settings = $this->settings_manager->getByObjId($tour->getId());
134 if (!$settings?->isActive()) {
139 if ($this->finish_manager->hasFinished($tour->getId(), $this->user->getId())) {
144 $screen_ids = $settings?->getScreenIds();
146 if (trim($screen_ids) !==
"") {
148 foreach (explode(
",", $screen_ids) as $screen_id) {
158 if ($settings->getLanguage() !==
"") {
159 if ($this->
user->getLanguage() !== $settings->getLanguage()) {
165 if ($settings->getPermission() !== PermissionType::None) {
166 switch ($settings->getPermission()) {
167 case PermissionType::Read:
172 case PermissionType::Write:
179 $subtypes = $this->obj_definition->getCreatableSubObjects(
185 foreach ($subtypes as $key => $value) {
186 if (!$can_create && $this->
access->checkAccess(
'create_' . $key,
'',
$ref_id, $current_type)) {
198 $ctrl->setParameterByClass(self::class,
"tour_id", $tour->getId());
199 $data->tour[$tour->getId()] = [
200 "name" => $tour->getTitle(),
201 "finishUrl" => $ctrl->getLinkTargetByClass(ilGuidedTourPageGUI::class,
"finishTour"),
203 foreach ($this->step_manager->getStepsOfTour($tour->getId()) as $step) {
204 $step_id = $step->getId();
205 $ctrl->setParameterByClass(self::class,
"step_id", $step_id);
206 $data->tour[$tour->getId()][
"steps"][
"step_" . $step_id] = [
208 "type" => $step->getType(),
209 "elementId" => $step->getElementId(),
210 "url" => $ctrl->getLinkTargetByClass(ilGuidedTourPageGUI::class,
"showStep"),
214 $this->gui->httpUtil()->sendJson(
$data);
219 $tour_id = $this->request->getTourId();
220 $step_id = $this->request->getStepId();
221 $this->page_manager->printPage($step_id);
226 $tour_id = $this->request->getTourId();
227 $this->finish_manager->setFinished($tour_id, $this->
user->getId());
228 $data = new \stdClass();
229 $data->finished =
true;
230 $this->gui->httpUtil()->sendJson(
$data);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class Link Attention: This is not the same as the \ILIAS\UI\Component\Link\Link.
@ilCtrl_Calls ilGuidedTourGUI: ilGuidedTourPageGUI
ILIAS Help InternalService $help
string $current_screen_id
ILIAS Help GuidedTour Settings SettingsManager $settings_manager
ILIAS Help GuidedTour UserFinished UserFinishedManager $finish_manager
ILIAS Help GuidedTour Page PageManager $page_manager
ILIAS Help GuidedTour Step StepManager $step_manager
ilObjectDefinition $obj_definition
ILIAS Help GuidedTour Tour TourManager $tour_manager
registerTabLink(string $tab_id, \ILIAS\UI\Component\Link\Standard $link)
ILIAS Help InternalGUIService $gui
ILIAS Help GuidedTour StandardGUIRequest $request
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupType(int $id, bool $reference=false)
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.