ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 forwardToPageObject ()
 
 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAuthPageEditorGUI::__construct ( int  $a_ref_id)

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

51 {
52 global $DIC;
53
54 $this->ctrl = $DIC->ctrl();
55 $this->tpl = $DIC->ui()->mainTemplate();
56 $this->tabs = $DIC->tabs();
57
58 $this->http = $DIC->http();
59 $this->refinery = $DIC->refinery();
60 $this->ui_factory = $DIC->ui()->factory();
61 $this->ui_renderer = $DIC->ui()->renderer();
62
63 $this->lng = $DIC['lng'];
64
65 $this->lng->loadLanguageModule('auth');
66
67 $this->ref_id = $a_ref_id;
68
69 $content_style = $DIC->contentStyle();
70 $this->content_style_domain = $content_style
71 ->domain()
72 ->styleForRefId($a_ref_id);
73 $this->content_style_gui = $content_style->gui();
74
75 $query_wrapper = $DIC->http()->wrapper()->query();
76 $post_wrapper = $DIC->http()->wrapper()->post();
77 $refinery = $DIC->refinery();
78
79 if ($query_wrapper->has('redirectSource')) {
80 $this->redirect_source = $query_wrapper->retrieve('redirectSource', $refinery->kindlyTo()->string());
81 }
82
83 if ($post_wrapper->has('key')) {
84 $this->requested_language_id = $post_wrapper->retrieve('key', $refinery->kindlyTo()->int());
85 } elseif ($query_wrapper->has('key')) {
86 $this->requested_language_id = $query_wrapper->retrieve('key', $refinery->kindlyTo()->int());
87 }
88
89 $this->request_ipe_context = $query_wrapper->retrieve(
90 self::CONTEXT_HTTP_PARAM,
91 $refinery->byTrying([
92 $refinery->kindlyTo()->string(),
93 $refinery->always(null)
94 ])
95 );
96 $this->ctrl->setParameter($this, self::CONTEXT_HTTP_PARAM, $this->request_ipe_context);
97 }
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 250 of file class.ilAuthPageEditorGUI.php.

250 : void
251 {
252 $lang_keys = $this->getLangKeysToUpdate();
255 );
256
257 foreach ($lang_keys as $lang_key) {
258 $settings->enableIliasEditor($lang_key, true);
259 }
260
261 $settings->update();
262
263 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
264 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
265 }
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 267 of file class.ilAuthPageEditorGUI.php.

267 : void
268 {
269 $lang_keys = $this->getLangKeysToUpdate();
272 );
273
274 foreach ($lang_keys as $lang_key) {
275 $settings->enableIliasEditor($lang_key, false);
276 }
277
278 $settings->update();
279
280 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_SUCCESS, $this->lng->txt('settings_saved'), true);
281 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
282 }

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 111 of file class.ilAuthPageEditorGUI.php.

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

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

+ Here is the call graph for this function:

◆ forwardToPageObject()

ilAuthPageEditorGUI::forwardToPageObject ( )
private

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

144 : void
145 {
146 if (!$this->requested_language_id) {
147 $this->tpl->setOnScreenMessage(
148 $this->tpl::MESSAGE_TYPE_FAILURE,
149 $this->lng->txt('language_does_not_exist'),
150 true
151 );
152 $this->ctrl->returnToParent($this);
153 }
154
155 $this->lng->loadLanguageModule('content');
156
157 $this->tabs->activateSubTab($this->getRequestedAuthPageEditorContext()->tabIdentifier());
158
159 $ipe_gui_class = $this->getRequestedAuthPageEditorContext()->pageUiClass();
160 $ipe_class = $this->getRequestedAuthPageEditorContext()->pageClass();
161 $ipe_page_type = $this->getRequestedAuthPageEditorContext()->pageType();
162
163 $this->ctrl->setParameter($this, 'key', $this->requested_language_id);
164
165 if (!$ipe_class::_exists($ipe_page_type, $this->requested_language_id)) {
166 $new_page_object = new $ipe_class();
167 $new_page_object->setParentId($this->requested_language_id);
168 $new_page_object->setId($this->requested_language_id);
169 $new_page_object->createFromXML();
170 }
171
172 $this->ctrl->setReturnByClass($ipe_gui_class, 'edit');
173 $page_gui = new ($ipe_gui_class)($this->requested_language_id);
174
175 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
176 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
177 $this->content_style_gui->addCss($this->tpl, $this->ref_id);
178
179 $page_gui->setTemplateTargetVar('ADM_CONTENT');
180 $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
181 $page_gui->setTemplateOutput(false);
182
183 $html = $this->ctrl->forwardCommand($page_gui);
184
185 if ($html !== '') {
186 $this->tpl->setContent($html);
187 }
188 }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)

References ILIAS\Repository\ctrl(), ilObjStyleSheet\getContentStylePath(), getRequestedAuthPageEditorContext(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

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

◆ getLangKeysToUpdate()

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

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

231 : array
232 {
233 $keys = $this->http->wrapper()->query()->retrieve(
234 'authpage_languages_key',
235 $this->refinery->byTrying([
236 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
237 $this->refinery->always([])
238 ])
239 );
240
241 $lang_keys = $this->lng->getInstalledLanguages();
242
243 if ((string) current($keys) !== 'ALL_OBJECTS') {
244 $lang_keys = array_intersect($keys, $lang_keys);
245 }
246
247 return $lang_keys;
248 }

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 139 of file class.ilAuthPageEditorGUI.php.

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

Referenced by activate(), deactivate(), forwardToPageObject(), 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 106 of file class.ilAuthPageEditorGUI.php.

106 : array
107 {
108 return [];
109 }

◆ 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 99 of file class.ilAuthPageEditorGUI.php.

99 : array
100 {
101 return [
103 ];
104 }
final const string LANGUAGE_TABLE_ACTIONS_COMMAND

References LANGUAGE_TABLE_ACTIONS_COMMAND.

◆ handlePageActionsCommand()

ilAuthPageEditorGUI::handlePageActionsCommand ( )
private

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

190 : void
191 {
192 $action = $this->http->wrapper()->query()->retrieve(
193 'authpage_languages_action',
194 $this->refinery->byTrying([
195 $this->refinery->kindlyTo()->string(),
196 $this->refinery->always('')
197 ])
198 );
199
200 $keys = $this->http->wrapper()->query()->retrieve(
201 'authpage_languages_key',
202 $this->refinery->byTrying([
203 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
204 $this->refinery->always([])
205 ])
206 );
207
208 switch ($action) {
209 case AuthPageLanguagesOverviewTable::DEACTIVATE:
210 case AuthPageLanguagesOverviewTable::ACTIVATE:
211 $this->$action();
212 break;
213
214 case AuthPageLanguagesOverviewTable::EDIT:
215 $language_id = ilLanguage::lookupId((string) current($keys));
216 if ($language_id) {
217 $this->ctrl->setParameter($this, 'key', $language_id);
218 $this->ctrl->redirectByClass(
219 $this->getRequestedAuthPageEditorContext()->pageUiClass(),
220 'edit'
221 );
222 }
223 }
224
225 $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
226 }
static lookupId(string $a_lang_key)
Lookup obj_id of language.

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

+ Here is the call graph for this function:

◆ showPageEditorLanguagesCommand()

ilAuthPageEditorGUI::showPageEditorLanguagesCommand ( )
private

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

284 : void
285 {
286 $this->tabs->activateSubTab($this->getRequestedAuthPageEditorContext()->tabIdentifier());
288 $this->ctrl,
289 $this->lng,
290 $this->http,
291 $this->ui_factory,
292 $this->ui_renderer,
294 );
295
296 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
297 }

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.

◆ $lng

ilLanguage ilAuthPageEditorGUI::$lng
private

Definition at line 36 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: