ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\StaticURL\Handler\LegacyGotoHandler Class Reference
+ Inheritance diagram for ILIAS\StaticURL\Handler\LegacyGotoHandler:
+ Collaboration diagram for ILIAS\StaticURL\Handler\LegacyGotoHandler:

Public Member Functions

 __construct ()
 
 getNamespace ()
 
 canHandle (Request $request)
 
 handle (Request $request, Context $context, Factory $response_factory)
 
 __construct ()
 
 getNamespace ()
 
 canHandle (Request $request)
 
 handle (Request $request, Context $context, Factory $response_factory)
 

Data Fields

const NAMESPACE = 'goto'
 
const TARGET = 'target'
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s
Deprecated:
since ILIAS 9. Use StaticURL service instead. Will be removed with ILIAS 11

Definition at line 33 of file LegacyGotoHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\StaticURL\Handler\LegacyGotoHandler::__construct ( )

Implements ILIAS\StaticURL\Handler\Handler.

Definition at line 35 of file LegacyGotoHandler.php.

36 {
37 }

Member Function Documentation

◆ canHandle()

ILIAS\StaticURL\Handler\LegacyGotoHandler::canHandle ( Request  $request)

Implements ILIAS\StaticURL\Handler\Handler.

Definition at line 47 of file LegacyGotoHandler.php.

47 : bool
48 {
49 return true;
50 }

◆ getNamespace()

ILIAS\StaticURL\Handler\LegacyGotoHandler::getNamespace ( )

◆ handle()

ILIAS\StaticURL\Handler\LegacyGotoHandler::handle ( Request  $request,
Context  $context,
Factory  $response_factory 
)
Deprecated:
since ILIAS 9. Use StaticURL service instead. Will be removed with ILIAS 11 This Method does not return a proper Repsonse to the Request, it just redirects like the original goto.php.

Implements ILIAS\StaticURL\Handler\Handler.

Definition at line 56 of file LegacyGotoHandler.php.

56 : Response
57 {
58 global $DIC, $ilPluginAdmin;
59
60 $orig_target = $requested_target = $request->getAdditionalParameters()[self::TARGET] ?? '';
61 $context->ctrl()->setTargetScript('ilias.php');
62
63 // THIS PARTS HAS BEEN MOVED FROM THE OLD goto.php
64 // DO NOT CHANGE ANYTHING HERE, IF YOU NEED TO CHANGE SOMETHING, IMPLEMENT A NEW HANDLER!
65
66 // user interface plugin slot hook
67 if (is_object($ilPluginAdmin)) {
68 // search
69 foreach ($DIC["component.factory"]->getActivePluginsInSlot("uihk") as $ui_plugin) {
70 $gui_class = $ui_plugin->getUIClassInstance();
71 $gui_class->gotoHook();
72 }
73 }
74
75 $r_pos = strpos((string) $requested_target, "_");
76 $rest = substr((string) $requested_target, $r_pos + 1);
77 $target_arr = explode("_", (string) $requested_target);
78 $target_type = $target_arr[0];
79 $target_id = $target_arr[1] ?? ''; // optional for plugins
80 $additional = $target_arr[2] ?? ''; // optional for pages
81
82 // imprint has no ref id...
83 if ($target_type === "impr") {
84 $DIC->ctrl()->redirectToURL('ilias.php?baseClass=ilImprintGUI');
85 }
86
87 // goto is not granted?
88 $user_id = $context->getUserId();
89 if (php_sapi_name() !== 'cli' && !\ilStartUpGUI::_checkGoto(
90 $requested_target
91 )) { // we cannot perform this in UnitTest e.g.
92 // if anonymous: go to login page
93 if ($user_id === 0 || $user_id === \ANONYMOUS_USER_ID) {
94 $url = "login.php?target="
95 . $orig_target . "&cmd=force_login&lang="
96 . $DIC->user()->getCurrentLanguage();
97 if ($DIC->http()->wrapper()->query()->has('soap_pw')) {
99 $url,
100 'soap_pw=' . $DIC->http()->wrapper()->query()->retrieve(
101 'soap_pw',
102 $DIC->refinery()->kindlyTo()->string()
103 )
104 );
105 }
106 if ($DIC->http()->wrapper()->query()->has('ext_uid')) {
108 $url,
109 'ext_uid=' . $DIC->http()->wrapper()->query()->retrieve(
110 'ext_uid',
111 $DIC->refinery()->kindlyTo()->string()
112 )
113 );
114 }
115 $DIC->ctrl()->redirectToURL($url);
116 } else {
117 // message if target given but not accessible
118 $tarr = explode("_", (string) $requested_target);
119 if ($tarr[0] !== "pg" && $tarr[0] !== "st" && isset($tarr[1]) && is_numeric($tarr[1]) && $tarr[1] > 0) {
120 $DIC->ui()->mainTemplate()->setOnScreenMessage(
121 'failure',
122 // no title: it would disclose objects without read permission or in the trash
123 $DIC->language()->txt("msg_no_perm_read_item"),
124 true
125 );
126 } else {
127 global $DIC;
128 $DIC->ui()->mainTemplate()->setOnScreenMessage(
129 'failure',
130 $DIC->language()->txt('permission_denied'),
131 true
132 );
133 }
134 $DIC->ctrl()->redirectToURL(\ilUserUtil::getStartingPointAsUrl());
135 }
136 }
137
138 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
139 //
140 // FOR NEW OBJECT TYPES:
141 // PLEASE USE DEFAULT IMPLEMENTATION ONLY
142 //
143 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
144
145 switch ($target_type) {
146 // exception, must be kept for now
147 case "pg":
149 break;
150
151 // exception, must be kept for now
152 case "st":
153 \ilStructureObjectGUI::_goto($target_id, (int) $additional);
154 break;
155
156 // exception, must be kept for now
157 case "git":
158 $target_ref_id = $target_arr[2] ?? 0;
159 \ilGlossaryTermGUI::_goto($target_id, (int) $target_ref_id);
160 break;
161
162 // please migrate to default branch implementation
163 case "glo":
164 \ilObjGlossaryGUI::_goto($target_id);
165 break;
166
167 // please migrate to default branch implementation
168 case "lm":
170 break;
171
172 // please migrate to default branch implementation
173 case "htlm":
174 \ilObjFileBasedLMGUI::_goto($target_id);
175 break;
176
177 // please migrate to default branch implementation
178 case "frm":
179 $target_thread = $target_arr[2] ?? 0;
180 $target_posting = $target_arr[3] ?? 0;
181 \ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
182 break;
183
184 // please migrate to default branch implementation
185 case "exc":
186 \ilObjExerciseGUI::_goto($target_id, $rest);
187 break;
188
189 // please migrate to default branch implementation
190 case "tst":
191 \ilObjTestGUI::_goto($target_id);
192 break;
193
194 // please migrate to default branch implementation
195 case "qpl":
196 \ilObjQuestionPoolGUI::_goto($target_id);
197 break;
198
199 // please migrate to default branch implementation
200 case "webr":
201 \ilObjLinkResourceGUI::_goto($target_id, $rest);
202 break;
203
204 // please migrate to default branch implementation
205 case "sahs":
207 break;
208
209 // please migrate to default branch implementation
210 case "crs":
211 \ilObjCourseGUI::_goto($target_id, $additional);
212 break;
213
214 // please migrate to default branch implementation
215 case "grp":
216 \ilObjGroupGUI::_goto($target_id, $additional);
217 break;
218
219 // please migrate to default branch implementation
220 case 'cert':
221 \ilCertificate::_goto($target_id);
222 break;
223
224 // former item group type, now object group
225 case 'itgr':
227 break;
228
229 //
230 // default implementation (should be used by all new object types)
231 //
232 default:
233 global $objDefinition;
234 if (!$objDefinition->isPlugin($target_type)) {
235 $class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
236 if (class_exists($class_name)) {
237 call_user_func([$class_name, "_goto"], $rest);
238 }
239 } else {
240 $class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
241 $location = $objDefinition->getLocation($target_type);
242 if (is_file($location . "/class." . $class_name . ".php")) {
243 call_user_func([$class_name, "_goto"], [$rest, $class_name]);
244 }
245 }
246 break;
247 }
248
249 return $response_factory->cannot();
250 }
$location
Definition: buildRTE.php:22
cannot()
The Handler cannot process the given Request at all, e.g.
Definition: Factory.php:47
static _goto(string $a_target, int $a_ref_id=0)
static _goto(string $a_target)
redirect script
static _goto(string $a_target)
static _goto($a_target, string $a_add="")
static _goto(string $a_target)
static _goto($a_target, $a_thread=0, $a_posting=0)
static _goto(string $a_target)
static _goto(string $a_target, string $a_add="")
static _goto(string $a_target, $a_additional=null)
static _goto(string $a_target)
static _goto(string $a_target)
goto target course
static _goto($target)
Redirect script to call a test with the test reference id.
static _goto(string $a_target, int $a_target_ref_id=0)
static getStartingPointAsUrl()
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39
global $DIC
Definition: shib_login.php:26

References $DIC, $location, $request, $user_id, ilObjForumGUI\_goto(), ilObjCourseGUI\_goto(), ilObjTestGUI\_goto(), ilObjGlossaryGUI\_goto(), ilObjFileBasedLMGUI\_goto(), ilLMPageObjectGUI\_goto(), ilObjContentObjectGUI\_goto(), ilObjObjectGroupGUI\_goto(), ilObjSAHSLearningModuleGUI\_goto(), ilObjLinkResourceGUI\_goto(), ilGlossaryTermGUI\_goto(), ilStructureObjectGUI\_goto(), ilObjGroupGUI\_goto(), ANONYMOUS_USER_ID, ilUtil\appendUrlParameterString(), ILIAS\StaticURL\Response\Factory\cannot(), ILIAS\StaticURL\Context\ctrl(), ilUserUtil\getStartingPointAsUrl(), ILIAS\StaticURL\Context\getUserId(), and ILIAS\StaticURL\Handler\LegacyGotoHandler\TARGET.

+ Here is the call graph for this function:

Field Documentation

◆ NAMESPACE

const ILIAS\StaticURL\Handler\LegacyGotoHandler::NAMESPACE = 'goto'

◆ TARGET


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