ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ilGuidedTourGUI Class Reference

@ilCtrl_Calls ilGuidedTourGUI: ilGuidedTourPageGUI More...

+ Inheritance diagram for ilGuidedTourGUI:
+ Collaboration diagram for ilGuidedTourGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 init ()
 
 registerTabLink (string $tab_id, \ILIAS\UI\Component\Link\Standard $link)
 
 getData ()
 

Protected Member Functions

 showStep ()
 
 finishTour ()
 

Protected Attributes

ilObjectDefinition $obj_definition
 
ilAccessHandler $access
 
ilObjUser $user
 
ILIAS Help GuidedTour UserFinished UserFinishedManager $finish_manager
 
string $current_screen_id
 
ILIAS Help GuidedTour Settings SettingsManager $settings_manager
 
ILIAS Help GuidedTour StandardGUIRequest $request
 
ILIAS Help GuidedTour Page PageManager $page_manager
 
ILIAS Help GuidedTour Tour TourManager $tour_manager
 
ILIAS Help GuidedTour Step StepManager $step_manager
 
ILIAS Help InternalGUIService $gui
 
ILIAS Help InternalService $help
 

Detailed Description

@ilCtrl_Calls ilGuidedTourGUI: ilGuidedTourPageGUI

Definition at line 28 of file class.ilGuidedTourGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilGuidedTourGUI::__construct ( )

Definition at line 43 of file class.ilGuidedTourGUI.php.

44 {
45 global $DIC;
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();
58 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\help(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilGuidedTourGUI::executeCommand ( )

Definition at line 60 of file class.ilGuidedTourGUI.php.

60 : void
61 {
62 $ctrl = $this->gui->ctrl();
63
64 $next_class = $ctrl->getNextClass($this);
65 $cmd = $ctrl->getCmd();
66
67 switch ($next_class) {
68 default:
69 if (in_array($cmd, [
70 "getData",
71 "showStep",
72 "finishTour"
73 ])) {
74 $this->$cmd();
75 }
76 }
77 }

◆ finishTour()

ilGuidedTourGUI::finishTour ( )
protected

Definition at line 224 of file class.ilGuidedTourGUI.php.

224 : void
225 {
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);
231 }

References $data, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getData()

ilGuidedTourGUI::getData ( )

Definition at line 116 of file class.ilGuidedTourGUI.php.

116 : void
117 {
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(''));
122 $current_screen_id = $this->help->gui()->standardRequest()->getScreenId();
123 $data = new \stdClass();
124 $popoverHtml = $r->renderAsync($popover);
125 // current workaround to not
126 $popoverHtml = str_replace("JSON.parse('{", "JSON.parse('{\"trigger\":\"manual\",", $popoverHtml);
127 $data->popoverHtml = $popoverHtml;
128 $data->popoverShowSignal = $popover->getShowSignal()->getId();
129 $data->tour = [];
130 $ref_id = $this->request->getRefId();
131 foreach ($this->tour_manager->getAll() as $tour) {
132 $settings = $this->settings_manager->getByObjId($tour->getId());
133 // check active
134 if (!$settings?->isActive()) {
135 continue;
136 }
137
138 // check finished
139 if ($this->finish_manager->hasFinished($tour->getId(), $this->user->getId())) {
140 continue;
141 }
142
143 // check screen id
144 $screen_ids = $settings?->getScreenIds();
145 $found = true;
146 if (trim($screen_ids) !== "") {
147 $found = false;
148 foreach (explode(",", $screen_ids) as $screen_id) {
149 if (trim($screen_id) === $current_screen_id) {
150 $found = true;
151 }
152 }
153 }
154 if (!$found) {
155 continue;
156 }
157 // check language
158 if ($settings->getLanguage() !== "") {
159 if ($this->user->getLanguage() !== $settings->getLanguage()) {
160 continue;
161 }
162 }
163 // check permission
164 if ($ref_id > 0) {
165 if ($settings->getPermission() !== PermissionType::None) {
166 switch ($settings->getPermission()) {
167 case PermissionType::Read:
168 if (!$this->access->checkAccess("read", "", $ref_id)) {
169 continue 2;
170 }
171 break;
172 case PermissionType::Write:
173 if (!$this->access->checkAccess("write", "", $ref_id)) {
174 continue 2;
175 }
176 break;
178 $current_type = ilObject::_lookupType($ref_id, true);
179 $subtypes = $this->obj_definition->getCreatableSubObjects(
180 $current_type,
182 $ref_id
183 );
184 $can_create = false;
185 foreach ($subtypes as $key => $value) {
186 if (!$can_create && $this->access->checkAccess('create_' . $key, '', $ref_id, $current_type)) {
187 $can_create = true;
188 }
189 }
190 if (!$can_create) {
191 continue 2;
192 }
193 break;
194 }
195 }
196 }
197
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"),
202 ];
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] = [
207 "id" => $step_id,
208 "type" => $step->getType(),
209 "elementId" => $step->getElementId(),
210 "url" => $ctrl->getLinkTargetByClass(ilGuidedTourPageGUI::class, "showStep"),
211 ];
212 }
213 }
214 $this->gui->httpUtil()->sendJson($data);
215 }
static _lookupType(int $id, bool $reference=false)
$ref_id
Definition: ltiauth.php:66

References $current_screen_id, $data, Vendor\Package\$f, $ref_id, ilObject\_lookupType(), ILIAS\Repository\access(), ILIAS\Help\GuidedTour\Settings\Create, ILIAS\Repository\help(), ilObjectDefinition\MODE_REPOSITORY, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ init()

ilGuidedTourGUI::init ( )

Definition at line 79 of file class.ilGuidedTourGUI.php.

79 : void
80 {
81 $mt = $this->gui->ui()->mainTemplate();
82 $f = $this->gui->ui()->factory();
83 $r = $this->gui->ui()->renderer();
84 $ctrl = $this->gui->ctrl();
85
86 if (!$this->tour_manager->anyActive()) {
87 return;
88 }
89
90 // ensure popover js being loaded
91 $r->render($f->popover()->standard($f->legacy()->content('')));
92
93 $debug = false;
94 $mt->addJavaScript("assets/js/repository.js");
95 if ($debug) {
96 $mt->addJavaScript("../components/ILIAS/Help/resources/guided-tour.js");
97 } else {
98 $mt->addJavaScript("assets/js/guided-tour.js");
99 }
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');");
104 }

References Vendor\Package\$f.

◆ registerTabLink()

ilGuidedTourGUI::registerTabLink ( string  $tab_id,
\ILIAS\UI\Component\Link\Standard  $link 
)

Definition at line 106 of file class.ilGuidedTourGUI.php.

107 {
108 if (!$this->tour_manager->anyActive()) {
109 return $link;
110 }
111 return $link->withAdditionalOnLoadCode(static function (string $id) use ($tab_id): string {
112 return "il.guidedTour.addMapping('$tab_id', '$id');";
113 });
114 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ showStep()

ilGuidedTourGUI::showStep ( )
protected

Definition at line 217 of file class.ilGuidedTourGUI.php.

217 : void
218 {
219 $tour_id = $this->request->getTourId();
220 $step_id = $this->request->getStepId();
221 $this->page_manager->printPage($step_id);
222 }

Field Documentation

◆ $access

ilAccessHandler ilGuidedTourGUI::$access
protected

Definition at line 31 of file class.ilGuidedTourGUI.php.

◆ $current_screen_id

string ilGuidedTourGUI::$current_screen_id
protected

Definition at line 34 of file class.ilGuidedTourGUI.php.

Referenced by getData().

◆ $finish_manager

ILIAS Help GuidedTour UserFinished UserFinishedManager ilGuidedTourGUI::$finish_manager
protected

Definition at line 33 of file class.ilGuidedTourGUI.php.

◆ $gui

ILIAS Help InternalGUIService ilGuidedTourGUI::$gui
protected

Definition at line 40 of file class.ilGuidedTourGUI.php.

◆ $help

ILIAS Help InternalService ilGuidedTourGUI::$help
protected

Definition at line 41 of file class.ilGuidedTourGUI.php.

◆ $obj_definition

ilObjectDefinition ilGuidedTourGUI::$obj_definition
protected

Definition at line 30 of file class.ilGuidedTourGUI.php.

◆ $page_manager

ILIAS Help GuidedTour Page PageManager ilGuidedTourGUI::$page_manager
protected

Definition at line 37 of file class.ilGuidedTourGUI.php.

◆ $request

ILIAS Help GuidedTour StandardGUIRequest ilGuidedTourGUI::$request
protected

Definition at line 36 of file class.ilGuidedTourGUI.php.

◆ $settings_manager

ILIAS Help GuidedTour Settings SettingsManager ilGuidedTourGUI::$settings_manager
protected

Definition at line 35 of file class.ilGuidedTourGUI.php.

◆ $step_manager

ILIAS Help GuidedTour Step StepManager ilGuidedTourGUI::$step_manager
protected

Definition at line 39 of file class.ilGuidedTourGUI.php.

◆ $tour_manager

ILIAS Help GuidedTour Tour TourManager ilGuidedTourGUI::$tour_manager
protected

Definition at line 38 of file class.ilGuidedTourGUI.php.

◆ $user

ilObjUser ilGuidedTourGUI::$user
protected

Definition at line 32 of file class.ilGuidedTourGUI.php.


The documentation for this class was generated from the following file: