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(
''));
123 $data = new \stdClass();
124 $popoverHtml = $r->renderAsync($popover);
125
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());
133
134 if (!$settings?->isActive()) {
135 continue;
136 }
137
138
139 if ($this->finish_manager->hasFinished($tour->getId(), $this->user->getId())) {
140 continue;
141 }
142
143
144 $screen_ids = $settings?->getScreenIds();
145 $found = true;
146 if (trim($screen_ids) !== "") {
147 $found = false;
148 foreach (explode(",", $screen_ids) as $screen_id) {
150 $found = true;
151 }
152 }
153 }
154 if (!$found) {
155 continue;
156 }
157
158 if ($settings->getLanguage() !== "") {
159 if ($this->
user->getLanguage() !== $settings->getLanguage()) {
160 continue;
161 }
162 }
163
165 if ($settings->getPermission() !== PermissionType::None) {
166 switch ($settings->getPermission()) {
167 case PermissionType::Read:
169 continue 2;
170 }
171 break;
172 case PermissionType::Write:
174 continue 2;
175 }
176 break;
179 $subtypes = $this->obj_definition->getCreatableSubObjects(
180 $current_type,
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 }
string $current_screen_id
static _lookupType(int $id, bool $reference=false)