ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilAuthPageEditorGUI Class Reference

@ilCtrl_isCalledBy ilAuthPageEditorGUI: ilObjAuthSettingsGUI @ilCtrl_Calls ilAuthPageEditorGUI: ilLoginPageGUI, ilLogoutPageGUI More...

+ Inheritance diagram for ilAuthPageEditorGUI:
+ Collaboration diagram for ilAuthPageEditorGUI:

Public Member Functions

 __construct (int $a_ref_id)
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 
 executeCommand ()
 
 getUnsafeGetCommands ()
 This method must return a list of unsafe GET commands. More...
 
 getSafePostCommands ()
 This method must return a list of safe POST commands. More...
 

Data Fields

final const string DEFAULT_COMMAND = 'showPageEditorLanguages'
 
final const string LANGUAGE_TABLE_ACTIONS_COMMAND = 'handlePageActions'
 
final const string CONTEXT_HTTP_PARAM = 'auth_ipe_context'
 

Private Member Functions

 getRequestedAuthPageEditorContext ()
 
 handlePageActionsCommand ()
 
 getLangKeysToUpdate ()
 
 activate ()
 
 deactivate ()
 
 showPageEditorLanguagesCommand ()
 

Private Attributes

ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 
string $redirect_source = null
 
int $requested_language_id = null
 
GUIService $content_style_gui
 
int $ref_id
 
string $request_ipe_context
 
ilRbacSystem $rbac_system
 
ilErrorHandling $ilErr
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAuthPageEditorGUI::__construct ( int  $a_ref_id)

Definition at line 52 of file class.ilAuthPageEditorGUI.php.

53 {
54 global $DIC;
55
56 $this->ctrl = $DIC->ctrl();
57 $this->tpl = $DIC->ui()->mainTemplate();
58 $this->tabs = $DIC->tabs();
59
60 $this->http = $DIC->http();
61 $this->ilErr = $DIC->ilErr();
62 $this->refinery = $DIC->refinery();
63 $this->ui_factory = $DIC->ui()->factory();
64 $this->ui_renderer = $DIC->ui()->renderer();
65 $this->rbac_system = $DIC->rbac()->system();
66
67 $this->lng = $DIC['lng'];
68
69 $this->lng->loadLanguageModule('auth');
70
71 $this->ref_id = $a_ref_id;
72
73 $content_style = $DIC->contentStyle();
74 $this->content_style_domain = $content_style
75 ->domain()
76 ->styleForRefId($a_ref_id);
77 $this->content_style_gui = $content_style->gui();
78
79 $query_wrapper = $DIC->http()->wrapper()->query();
80 $post_wrapper = $DIC->http()->wrapper()->post();
81 $refinery = $DIC->refinery();
82
83 if ($query_wrapper->has('redirectSource')) {
84 $this->redirect_source = $query_wrapper->retrieve('redirectSource', $refinery->kindlyTo()->string());
85 }
86
87 if ($post_wrapper->has('key')) {
88 $this->requested_language_id = $post_wrapper->retrieve('key', $refinery->kindlyTo()->int());
89 } elseif ($query_wrapper->has('key')) {
90 $this->requested_language_id = $query_wrapper->retrieve('key', $refinery->kindlyTo()->int());
91 }
92
93 $this->request_ipe_context = $query_wrapper->retrieve(
94 self::CONTEXT_HTTP_PARAM,
95 $refinery->byTrying([
96 $refinery->kindlyTo()->string(),
97 $refinery->always(null)
98 ])
99 );
100 $this->ctrl->setParameter($this, self::CONTEXT_HTTP_PARAM, $this->request_ipe_context);
101 }
ILIAS Refinery Factory $refinery
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, $refinery, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilAuthPageEditorGUI::activate ( )
private

Definition at line 265 of file class.ilAuthPageEditorGUI.php.

265 : void
266 {
267 $lang_keys = $this->getLangKeysToUpdate();
270 );
271
272 foreach ($lang_keys as $lang_key) {
273 $settings->enableIliasEditor($lang_key, true);
274 }
275
276 $settings->update();
277
278 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
279 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
280 }
static getInstance(AuthPageEditorContext $context)

References ILIAS\Repository\ctrl(), ilAuthPageEditorSettings\getInstance(), getLangKeysToUpdate(), getRequestedAuthPageEditorContext(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deactivate()

ilAuthPageEditorGUI::deactivate ( )
private

Definition at line 282 of file class.ilAuthPageEditorGUI.php.

282 : void
283 {
284 $lang_keys = $this->getLangKeysToUpdate();
287 );
288
289 foreach ($lang_keys as $lang_key) {
290 $settings->enableIliasEditor($lang_key, false);
291 }
292
293 $settings->update();
294
295 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
296 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
297 }

References ILIAS\Repository\ctrl(), ilAuthPageEditorSettings\getInstance(), getLangKeysToUpdate(), getRequestedAuthPageEditorContext(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilAuthPageEditorGUI::executeCommand ( )

Definition at line 115 of file class.ilAuthPageEditorGUI.php.

115 : void
116 {
117 switch (strtolower($this->ctrl->getNextClass($this) ?? '')) {
118 case strtolower(ilLoginPageGUI::class):
119 case strtolower(ilLogoutPageGUI::class):
120 $this->tabs->clearTargets();
121 $this->tabs->setBackTarget(
122 $this->lng->txt('back'),
123 $this->ctrl->getLinkTarget($this, self::DEFAULT_COMMAND)
124 );
125
126 if (strtolower($this->redirect_source ?? '') !== strtolower(ilInternalLinkGUI::class)) {
127 $this->forwardToPageObject();
128 }
129 break;
130
131 default:
132 $cmd = $this->ctrl->getCmd();
133 if ($cmd === null || $cmd === '' || !method_exists($this, $cmd . 'Command')) {
135 }
136 $verified_command = $cmd . 'Command';
137
138 $this->$verified_command();
139 break;
140 }
141 }
final const string DEFAULT_COMMAND
@ilCtrl_Calls ilLogoutPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ilLog...

References ILIAS\Repository\ctrl(), DEFAULT_COMMAND, ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ getLangKeysToUpdate()

ilAuthPageEditorGUI::getLangKeysToUpdate ( )
private
Returns
list<string>

Definition at line 246 of file class.ilAuthPageEditorGUI.php.

246 : array
247 {
248 $keys = $this->http->wrapper()->query()->retrieve(
249 'authpage_languages_key',
250 $this->refinery->byTrying([
251 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
252 $this->refinery->always([])
253 ])
254 );
255
256 $lang_keys = $this->lng->getInstalledLanguages();
257
258 if ((string) current($keys) !== 'ALL_OBJECTS') {
259 $lang_keys = array_intersect($keys, $lang_keys);
260 }
261
262 return $lang_keys;
263 }

References ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by activate(), and deactivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestedAuthPageEditorContext()

ilAuthPageEditorGUI::getRequestedAuthPageEditorContext ( )
private

Definition at line 143 of file class.ilAuthPageEditorGUI.php.

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

Referenced by activate(), deactivate(), handlePageActionsCommand(), and showPageEditorLanguagesCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSafePostCommands()

ilAuthPageEditorGUI::getSafePostCommands ( )

This method must return a list of safe POST commands.

Safe post commands returned by this method will no longer be CSRF protected and will NOT be appended by an ilCtrlToken.

Returns
string[]

Implements ilCtrlSecurityInterface.

Definition at line 110 of file class.ilAuthPageEditorGUI.php.

110 : array
111 {
112 return [];
113 }

◆ getUnsafeGetCommands()

ilAuthPageEditorGUI::getUnsafeGetCommands ( )

This method must return a list of unsafe GET commands.

Unsafe get commands returned by this method will now be CSRF protected, which means an ilCtrlToken is appended each time a link-target is generated to the class implementing this interface with a command from that list.

Tokens will be validated in

See also
ilCtrlInterface::getCmd(), whereas the fallback command will be used if the CSRF validation fails.
Returns
string[]

Implements ilCtrlSecurityInterface.

Definition at line 103 of file class.ilAuthPageEditorGUI.php.

103 : array
104 {
105 return [
107 ];
108 }
final const string LANGUAGE_TABLE_ACTIONS_COMMAND

References LANGUAGE_TABLE_ACTIONS_COMMAND.

◆ handlePageActionsCommand()

ilAuthPageEditorGUI::handlePageActionsCommand ( )
private

Definition at line 200 of file class.ilAuthPageEditorGUI.php.

200 : void
201 {
202 $action = $this->http->wrapper()->query()->retrieve(
203 'authpage_languages_action',
204 $this->refinery->byTrying([
205 $this->refinery->kindlyTo()->string(),
206 $this->refinery->always('')
207 ])
208 );
209
210 $keys = $this->http->wrapper()->query()->retrieve(
211 'authpage_languages_key',
212 $this->refinery->byTrying([
213 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
214 $this->refinery->always([])
215 ])
216 );
217
218 switch ($action) {
219 case AuthPageLanguagesOverviewTable::DEACTIVATE:
220 case AuthPageLanguagesOverviewTable::ACTIVATE:
221 if (!$this->rbac_system->checkAccess('write', $this->ref_id)) {
222 $this->ilErr->raiseError($this->lng->txt('permission_denied'), $this->ilErr->WARNING);
223 break;
224 }
225 $this->$action();
226 break;
227
228 case AuthPageLanguagesOverviewTable::EDIT:
229 case AuthPageLanguagesOverviewTable::PREVIEW:
230 $language_id = ilLanguage::lookupId((string) current($keys));
231 if ($language_id) {
232 $this->ctrl->setParameter($this, 'key', $language_id);
233 $this->ctrl->redirectByClass(
234 $this->getRequestedAuthPageEditorContext()->pageUiClass(),
235 $action
236 );
237 }
238 }
239
240 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
241 }
static lookupId(string $a_lang_key)
Lookup obj_id of language.

References ILIAS\Repository\ctrl(), getRequestedAuthPageEditorContext(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilLanguage\lookupId(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ showPageEditorLanguagesCommand()

ilAuthPageEditorGUI::showPageEditorLanguagesCommand ( )
private

Definition at line 299 of file class.ilAuthPageEditorGUI.php.

299 : void
300 {
301 $this->tabs->activateSubTab($this->getRequestedAuthPageEditorContext()->tabIdentifier());
303 $this->ctrl,
304 $this->lng,
305 $this->http,
306 $this->ui_factory,
307 $this->ui_renderer,
309 $this->rbac_system->checkAccess('write', $this->ref_id)
310 );
311
312 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
313 }

References ILIAS\Repository\ctrl(), getRequestedAuthPageEditorContext(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Field Documentation

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilAuthPageEditorGUI::$content_style_domain
private

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

◆ $content_style_gui

GUIService ilAuthPageEditorGUI::$content_style_gui
private

Definition at line 46 of file class.ilAuthPageEditorGUI.php.

◆ $ctrl

ilCtrlInterface ilAuthPageEditorGUI::$ctrl
private

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

◆ $http

ILIAS HTTP Services ilAuthPageEditorGUI::$http
private

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

◆ $ilErr

ilErrorHandling ilAuthPageEditorGUI::$ilErr
private

Definition at line 50 of file class.ilAuthPageEditorGUI.php.

◆ $lng

ilLanguage ilAuthPageEditorGUI::$lng
private

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

◆ $rbac_system

ilRbacSystem ilAuthPageEditorGUI::$rbac_system
private

Definition at line 49 of file class.ilAuthPageEditorGUI.php.

◆ $redirect_source

string ilAuthPageEditorGUI::$redirect_source = null
private

Definition at line 44 of file class.ilAuthPageEditorGUI.php.

◆ $ref_id

int ilAuthPageEditorGUI::$ref_id
private

Definition at line 47 of file class.ilAuthPageEditorGUI.php.

◆ $refinery

ILIAS Refinery Factory ilAuthPageEditorGUI::$refinery
private

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

Referenced by __construct().

◆ $request_ipe_context

string ilAuthPageEditorGUI::$request_ipe_context
private

Definition at line 48 of file class.ilAuthPageEditorGUI.php.

◆ $requested_language_id

int ilAuthPageEditorGUI::$requested_language_id = null
private

Definition at line 45 of file class.ilAuthPageEditorGUI.php.

◆ $tabs

ilTabsGUI ilAuthPageEditorGUI::$tabs
private

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

◆ $tpl

ilGlobalTemplateInterface ilAuthPageEditorGUI::$tpl
private

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

◆ $ui_factory

ILIAS UI Factory ilAuthPageEditorGUI::$ui_factory
private

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

◆ $ui_renderer

ILIAS UI Renderer ilAuthPageEditorGUI::$ui_renderer
private

Definition at line 42 of file class.ilAuthPageEditorGUI.php.

◆ CONTEXT_HTTP_PARAM

final const string ilAuthPageEditorGUI::CONTEXT_HTTP_PARAM = 'auth_ipe_context'

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

Referenced by ilObjAuthSettingsGUI\setSubTabs().

◆ DEFAULT_COMMAND

final const string ilAuthPageEditorGUI::DEFAULT_COMMAND = 'showPageEditorLanguages'

◆ LANGUAGE_TABLE_ACTIONS_COMMAND

final const string ilAuthPageEditorGUI::LANGUAGE_TABLE_ACTIONS_COMMAND = 'handlePageActions'

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