ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 sprintf(
123 $DIC->language()->txt("msg_no_perm_read_item"),
125 ),
126 true
127 );
128 } else {
129 global $DIC;
130 $DIC->ui()->mainTemplate()->setOnScreenMessage(
131 'failure',
132 $DIC->language()->txt('permission_denied'),
133 true
134 );
135 }
136 $DIC->ctrl()->redirectToURL(\ilUserUtil::getStartingPointAsUrl());
137 }
138 }
139
140 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
141 //
142 // FOR NEW OBJECT TYPES:
143 // PLEASE USE DEFAULT IMPLEMENTATION ONLY
144 //
145 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
146
147 switch ($target_type) {
148 // exception, must be kept for now
149 case "pg":
151 break;
152
153 // exception, must be kept for now
154 case "st":
155 \ilStructureObjectGUI::_goto($target_id, (int) $additional);
156 break;
157
158 // exception, must be kept for now
159 case "git":
160 $target_ref_id = $target_arr[2] ?? 0;
161 \ilGlossaryTermGUI::_goto($target_id, (int) $target_ref_id);
162 break;
163
164 // please migrate to default branch implementation
165 case "glo":
166 \ilObjGlossaryGUI::_goto($target_id);
167 break;
168
169 // please migrate to default branch implementation
170 case "lm":
172 break;
173
174 // please migrate to default branch implementation
175 case "htlm":
176 \ilObjFileBasedLMGUI::_goto($target_id);
177 break;
178
179 // please migrate to default branch implementation
180 case "frm":
181 $target_thread = $target_arr[2] ?? 0;
182 $target_posting = $target_arr[3] ?? 0;
183 \ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
184 break;
185
186 // please migrate to default branch implementation
187 case "exc":
188 \ilObjExerciseGUI::_goto($target_id, $rest);
189 break;
190
191 // please migrate to default branch implementation
192 case "tst":
193 \ilObjTestGUI::_goto($target_id);
194 break;
195
196 // please migrate to default branch implementation
197 case "qpl":
198 \ilObjQuestionPoolGUI::_goto($target_id);
199 break;
200
201 // please migrate to default branch implementation
202 case "webr":
203 \ilObjLinkResourceGUI::_goto($target_id, $rest);
204 break;
205
206 // please migrate to default branch implementation
207 case "sahs":
209 break;
210
211 // please migrate to default branch implementation
212 case "crs":
213 \ilObjCourseGUI::_goto($target_id, $additional);
214 break;
215
216 // please migrate to default branch implementation
217 case "grp":
218 \ilObjGroupGUI::_goto($target_id, $additional);
219 break;
220
221 // please migrate to default branch implementation
222 case 'cert':
223 \ilCertificate::_goto($target_id);
224 break;
225
226 //
227 // default implementation (should be used by all new object types)
228 //
229 default:
230 global $objDefinition;
231 if (!$objDefinition->isPlugin($target_type)) {
232 $class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
233 if (class_exists($class_name)) {
234 call_user_func([$class_name, "_goto"], $rest);
235 }
236 } else {
237 $class_name = "ilObj" . $objDefinition->getClassName($target_type) . "GUI";
238 $location = $objDefinition->getLocation($target_type);
239 if (is_file($location . "/class." . $class_name . ".php")) {
240 call_user_func([$class_name, "_goto"], [$rest, $class_name]);
241 }
242 }
243 break;
244 }
245
246 return $response_factory->cannot();
247 }
$location
Definition: buildRTE.php:22
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)
goto target course
static _goto($target)
Redirect script to call a test with the test reference id.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_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
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68
$context
Definition: webdav.php:31

References $context, $DIC, $location, $url, $user_id, ilObjForumGUI\_goto(), ilObjCourseGUI\_goto(), ilObjTestGUI\_goto(), ilObjGlossaryGUI\_goto(), ilObjFileBasedLMGUI\_goto(), ilLMPageObjectGUI\_goto(), ilObjContentObjectGUI\_goto(), ilObjSAHSLearningModuleGUI\_goto(), ilObjLinkResourceGUI\_goto(), ilGlossaryTermGUI\_goto(), ilStructureObjectGUI\_goto(), ilObjGroupGUI\_goto(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ANONYMOUS_USER_ID, ilUtil\appendUrlParameterString(), ILIAS\StaticURL\Response\Factory\cannot(), ILIAS\StaticURL\Request\Request\getAdditionalParameters(), ilUserUtil\getStartingPointAsUrl(), 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: