ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAuthPageEditorGUI Class Reference

ilAuthPageEditorGUI: ilObjAuthSettingsGUI ilAuthPageEditorGUI: ilLoginPageGUI, ilLogoutPageGUI More...

+ Collaboration diagram for ilAuthPageEditorGUI:

Public Member Functions

 __construct (int $a_ref_id)
 
 executeCommand ()
 

Data Fields

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

Private Member Functions

 getRequestedAuthPageEditorContext ()
 
 forwardToPageObject ()
 
 handlePageActions ()
 
 getLangKeysToUpdate ()
 
 activate ()
 
 deactivate ()
 
 showPageEditorLanguages ()
 

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.

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
ILIAS Refinery Factory $refinery
+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilAuthPageEditorGUI::activate ( )
private

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

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

Referenced by handlePageActions().

234  : void
235  {
236  $lang_keys = $this->getLangKeysToUpdate();
239  );
240 
241  foreach ($lang_keys as $lang_key) {
242  $settings->enableIliasEditor($lang_key, true);
243  }
244 
245  $settings->update();
246 
247  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
248  $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
249  }
static getInstance(AuthPageEditorContext $context)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deactivate()

ilAuthPageEditorGUI::deactivate ( )
private

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

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

Referenced by handlePageActions().

251  : void
252  {
253  $lang_keys = $this->getLangKeysToUpdate();
256  );
257 
258  foreach ($lang_keys as $lang_key) {
259  $settings->enableIliasEditor($lang_key, false);
260  }
261 
262  $settings->update();
263 
264  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
265  $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
266  }
static getInstance(AuthPageEditorContext $context)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAuthPageEditorGUI::executeCommand ( )

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

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

99  : void
100  {
101  switch (strtolower($this->ctrl->getNextClass($this) ?? '')) {
102  case strtolower(ilLoginPageGUI::class):
103  case strtolower(ilLogoutPageGUI::class):
104  $this->tabs->clearTargets();
105  $this->tabs->setBackTarget(
106  $this->lng->txt('back'),
107  $this->ctrl->getLinkTarget($this, self::DEFAULT_COMMAND)
108  );
109 
110  if (strtolower($this->redirect_source ?? '') !== strtolower(ilInternalLinkGUI::class)) {
111  $this->forwardToPageObject();
112  }
113  break;
114 
115  default:
116  if (!$cmd = $this->ctrl->getCmd()) {
117  $cmd = 'showPageEditorLanguages';
118  }
119  $this->$cmd();
120  break;
121  }
122  }
ilLogoutPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilLogoutPageGUI: ilPublicUserPro...
+ Here is the call graph for this function:

◆ forwardToPageObject()

ilAuthPageEditorGUI::forwardToPageObject ( )
private

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

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

Referenced by executeCommand().

129  : void
130  {
131  if (!$this->requested_language_id) {
132  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('language_does_not_exist'), true);
133  $this->ctrl->returnToParent($this);
134  }
135 
136  $this->lng->loadLanguageModule('content');
137 
138  $this->tabs->activateSubTab($this->getRequestedAuthPageEditorContext()->tabIdentifier());
139 
140  $ipe_gui_class = $this->getRequestedAuthPageEditorContext()->pageUiClass();
141  $ipe_class = $this->getRequestedAuthPageEditorContext()->pageClass();
142  $ipe_page_type = $this->getRequestedAuthPageEditorContext()->pageType();
143 
144  $this->ctrl->setParameter($this, 'key', $this->requested_language_id);
145 
146  if (!$ipe_class::_exists($ipe_page_type, $this->requested_language_id)) {
147  $new_page_object = new $ipe_class();
148  $new_page_object->setParentId($this->requested_language_id);
149  $new_page_object->setId($this->requested_language_id);
150  $new_page_object->createFromXML();
151  }
152 
153  $this->ctrl->setReturnByClass($ipe_gui_class, 'edit');
154  $page_gui = new ($ipe_gui_class)($this->requested_language_id);
155 
156  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
157  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
158  $this->content_style_gui->addCss($this->tpl, $this->ref_id);
159 
160  $page_gui->setTemplateTargetVar('ADM_CONTENT');
161  $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
162  $page_gui->setTemplateOutput(false);
163 
164  $html = $this->ctrl->forwardCommand($page_gui);
165 
166  if ($html !== '') {
167  $this->tpl->setContent($html);
168  }
169  }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
+ 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 215 of file class.ilAuthPageEditorGUI.php.

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

Referenced by activate(), and deactivate().

215  : array
216  {
217  $keys = $this->http->wrapper()->query()->retrieve(
218  'authpage_languages_key',
219  $this->refinery->byTrying([
220  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
221  $this->refinery->always([])
222  ])
223  );
224 
225  $lang_keys = $this->lng->getInstalledLanguages();
226 
227  if ((string) current($keys) !== 'ALL_OBJECTS') {
228  $lang_keys = array_intersect($keys, $lang_keys);
229  }
230 
231  return $lang_keys;
232  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestedAuthPageEditorContext()

ilAuthPageEditorGUI::getRequestedAuthPageEditorContext ( )
private

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

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

Referenced by activate(), deactivate(), forwardToPageObject(), handlePageActions(), and showPageEditorLanguages().

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

◆ handlePageActions()

ilAuthPageEditorGUI::handlePageActions ( )
private

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

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

171  : void
172  {
173  $action = $this->http->wrapper()->query()->retrieve(
174  'authpage_languages_action',
175  $this->refinery->byTrying([
176  $this->refinery->kindlyTo()->string(),
177  $this->refinery->always('')
178  ])
179  );
180 
181  $keys = $this->http->wrapper()->query()->retrieve(
182  'authpage_languages_key',
183  $this->refinery->byTrying([
184  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string()),
185  $this->refinery->always([])
186  ])
187  );
188 
189  switch ($action) {
190  case AuthPageLanguagesOverviewTable::DEACTIVATE:
191  $this->deactivate();
192  break;
193 
194  case AuthPageLanguagesOverviewTable::ACTIVATE:
195  $this->activate();
196  break;
197 
198  case AuthPageLanguagesOverviewTable::EDIT:
199  $language_id = ilLanguage::lookupId((string) current($keys));
200  if ($language_id) {
201  $this->ctrl->setParameter($this, 'key', $language_id);
202  $this->ctrl->redirectByClass(
203  $this->getRequestedAuthPageEditorContext()->pageUiClass(),
204  'edit'
205  );
206  }
207  }
208 
209  $this->ctrl->redirect($this, self::DEFAULT_COMMAND);
210  }
static http()
Fetches the global http state from ILIAS.
static lookupId(string $a_lang_key)
Lookup obj_id of language.
+ Here is the call graph for this function:

◆ showPageEditorLanguages()

ilAuthPageEditorGUI::showPageEditorLanguages ( )
private

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

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

268  : void
269  {
270  $this->tabs->activateSubTab($this->getRequestedAuthPageEditorContext()->tabIdentifier());
272  $this->ctrl,
273  $this->lng,
274  $this->http,
275  $this->ui_factory,
276  $this->ui_renderer,
278  );
279 
280  $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
281  }
static http()
Fetches the global http state from ILIAS.
+ 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.

◆ $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 ilAuthPageEditorGUI::CONTEXT_HTTP_PARAM = 'auth_ipe_context'

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

Referenced by ilObjAuthSettingsGUI\setSubTabs().

◆ DEFAULT_COMMAND

final const ilAuthPageEditorGUI::DEFAULT_COMMAND = 'showPageEditorLanguages'

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

Referenced by ilObjAuthSettingsGUI\setSubTabs().

◆ LANGUAGE_TABLE_ACTIONS_COMMAND

final const ilAuthPageEditorGUI::LANGUAGE_TABLE_ACTIONS_COMMAND = 'handlePageActions'

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