Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Design Logout Page #7906

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
eed538b
Feature: Design Logout Page
Aug 7, 2024
a70a1c0
cs fixer
Aug 7, 2024
939a58a
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
d837e4f
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
0ea9701
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
87573f2
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
da259f6
Update components/ILIAS/Authentication/classes/class.ilObjAuthSetting…
Aug 8, 2024
c1b87a4
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
a85904e
Update components/ILIAS/Authentication/classes/class.ilObjAuthSetting…
Aug 8, 2024
6c94c84
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
afa8ef8
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
cd16f4d
Update components/ILIAS/Authentication/classes/LogoutPage/LogoutPageL…
Aug 8, 2024
4b86cca
Update components/ILIAS/Init/classes/class.ilStartUpGUI.php
Aug 8, 2024
fc2288e
Update components/ILIAS/Init/classes/class.ilStartUpGUI.php
Aug 8, 2024
c3fcd8b
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
b4c84a5
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
5984b37
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
05c4ca5
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
cf3bfd5
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
396139d
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
53c7ad1
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
4726454
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
d5c1bf5
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
d497a79
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
a7b0b3d
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
46fc83d
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
c23a3fe
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
275b705
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
1cef9a7
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
abf5a4b
Code improvement
Aug 8, 2024
2ee1d4c
Code improvement
Aug 8, 2024
b36ba36
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
5993e0d
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
ce706f6
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
f742253
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
d5de4bd
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
0dd3532
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 8, 2024
20ce8a5
Code improvement
Aug 9, 2024
856b70d
Code style
Aug 9, 2024
443a65d
Removed unused properties
Aug 9, 2024
a91b3f0
code style
Aug 9, 2024
1b6738a
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 9, 2024
a6fc036
Update components/ILIAS/Authentication/classes/class.ilAuthLogoutPage…
Aug 12, 2024
75396b7
Added missing strtolower
Aug 12, 2024
dfabd35
Fixed lang vars
Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,31 @@ public function __construct(int $a_ref_id)

$query_wrapper = $DIC->http()->wrapper()->query();
$post_wrapper = $DIC->http()->wrapper()->post();
$is_post_request = $DIC->http()->request()->getMethod() === "POST";
$is_post_request = $DIC->http()->request()->getMethod() === 'POST';
$refinery = $DIC->refinery();

if ($query_wrapper->has("redirectSource")) {
$this->redirect_source = $query_wrapper->retrieve("redirectSource", $refinery->kindlyTo()->string());
if ($query_wrapper->has('redirectSource')) {
$this->redirect_source = $query_wrapper->retrieve('redirectSource', $refinery->kindlyTo()->string());
}

if ($post_wrapper->has("key")) {
$this->key = $post_wrapper->retrieve("key", $refinery->kindlyTo()->int());
} elseif ($query_wrapper->has("key")) {
$this->key = $query_wrapper->retrieve("key", $refinery->kindlyTo()->int());
if ($post_wrapper->has('key')) {
$this->key = $post_wrapper->retrieve('key', $refinery->kindlyTo()->int());
} elseif ($query_wrapper->has('key')) {
$this->key = $query_wrapper->retrieve('key', $refinery->kindlyTo()->int());
}

if ($is_post_request) {
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
if ($post_wrapper->has("visible_languages")) {
if ($post_wrapper->has('visible_languages')) {
$this->visible_languages = $post_wrapper->retrieve(
"visible_languages", $refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
'visible_languages',
$refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
);
}

if ($post_wrapper->has("languages")) {
if ($post_wrapper->has('languages')) {
$this->languages = $post_wrapper->retrieve(
"languages", $refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
'languages',
$refinery->kindlyTo()->listOf($refinery->kindlyTo()->string())
);
}
}
Expand All @@ -117,16 +119,16 @@ public function getRefId(): int

public function executeCommand(): void
{
switch ($this->ctrl->getNextClass($this)) {
case 'illogoutpagegui':
switch (strtolower($this->ctrl->getNextClass($this))) {
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
case strtolower(ilLogoutPageGUI::class):
$this->tabs->clearTargets();
$this->tabs->setBackTarget(
$this->lng->txt('back'),
$this->ctrl->getLinkTarget($this, 'show'),
'_top'
);

if ($this->redirect_source !== 'ilinternallinkgui') {
if ($this->redirect_source !== strtolower(ilInternalLinkGUI::class)) {
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
$this->forwardToPageObject();
}
break;
Expand Down Expand Up @@ -167,7 +169,7 @@ private function forwardToPageObject(): void
$this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
$this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());

$this->ctrl->setReturnByClass('illogoutpagegui', 'edit');
$this->ctrl->setReturnByClass(ilLogoutPageGUI::class, 'edit');
$page_gui = new ilLogoutPageGUI($this->key);

$page_gui->setTemplateTargetVar('ADM_CONTENT');
Expand All @@ -177,19 +179,14 @@ private function forwardToPageObject(): void

$html = $this->ctrl->forwardCommand($page_gui);

if ($html !== "") {
if ($html !== '') {
$this->tpl->setContent($html);
}
}

private function show(): void
{
switch ($this->getSettings()->getMode()) {
case ilAuthLogoutPageEditorSettings::MODE_IPE:
default:
$this->showIliasEditor();
break;
}
$this->showIliasEditor();
}

private function handleLogoutPageActions(): void
Expand Down Expand Up @@ -220,7 +217,7 @@ private function handleLogoutPageActions(): void
case 'edit':
$this->ctrl->setParameter($this, 'logoutpage_languages_key', current($keys));
$this->ctrl->setParameter($this, 'key', ilLanguage::lookupId(current($keys)));
$this->ctrl->redirectByClass('ilLogoutPageGUI', 'edit');
$this->ctrl->redirectByClass(ilLogoutPageGUI::class, 'edit');
break;
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
default:
$this->ctrl->redirect($this, 'show');
Expand Down Expand Up @@ -292,15 +289,15 @@ private function showIliasEditor(): void

private function saveLogoutInfo(): void
{
if (!$this->rbacsystem->checkAccess("write", $this->getRefId())) {
$this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
if (!$this->rbacsystem->checkAccess('write', $this->getRefId())) {
$this->ilErr->raiseError($this->lng->txt('permission_denied'), $this->ilErr->MESSAGE);
}

$this->initLogoutForm();
if ($this->form->checkInput()) {
$this->logoutSettings = new ilSetting("logout_settings");
$this->logoutSettings = new ilSetting('logout_settings');
foreach ($this->lng->getInstalledLanguages() as $lang_key) {
$settingKey = "logout_message_" . $lang_key;
$settingKey = 'logout_message_' . $lang_key;
if ($this->form->getInput($settingKey)) {
$this->logoutSettings->set($settingKey, $this->form->getInput($settingKey));
}
Expand All @@ -310,7 +307,7 @@ private function saveLogoutInfo(): void
$this->setting->set('default_auth_mode', $this->form->getInput('default_auth_mode'));
}

$this->tpl->setOnScreenMessage('success', $this->lng->txt("logout_information_settings_saved"), true);
$this->tpl->setOnScreenMessage('success', $this->lng->txt('logout_information_settings_saved'), true);
}

$this->ctrl->redirect($this, 'show');
Expand All @@ -326,7 +323,7 @@ private function initLogoutForm(): void
$this->form->addCommandButton('saveLogoutInfo', $this->lng->txt('save'));

if (!is_object($this->logoutSettings)) {
$this->logoutSettings = new ilSetting("logout_settings");
$this->logoutSettings = new ilSetting('logout_settings');
}

$logout_settings = $this->logoutSettings->getAll();
Expand Down Expand Up @@ -368,25 +365,22 @@ private function initLogoutForm(): void
$textarea->setValue($message);

if (!in_array($lang_key, $languages, true)) {
$textarea->setAlert($this->lng->txt("not_installed"));
$textarea->setAlert($this->lng->txt('not_installed'));
}

$this->form->addItem($textarea);
}
}

/**
* returns an array of all installed languages, default language at the first position
* @param string $a_def_language Default language of the current installation
* @param array $a_languages Array of all installed languages
* @return array $languages Array of the installed languages, default language at first position or
* an empty array, if $a_a_def_language is empty
* @author Michael Jansen
* @param string $a_def_language
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
* @param array<string> $a_languages
* @return array<string>
*/
private function setDefLangFirst(string $a_def_language, array $a_languages): array
{
$languages = [];
if ($a_def_language !== "") {
if ($a_def_language !== '') {
$languages[] = $a_def_language;

foreach ($a_languages as $val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@

class ilAuthLogoutPageEditorSettings
{
public const MODE_IPE = 2;
private static ?ilAuthLogoutPageEditorSettings $instance = null;
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved

private array $languages = [];
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved

nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
private static ?ilAuthLogoutPageEditorSettings $instance = null;
private ilSetting $storage;

nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
private int $mode = 0;

private ilLanguage $lng;

public function __construct()
nmatuschek marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -42,27 +39,14 @@ public function __construct()

public static function getInstance(): ilAuthLogoutPageEditorSettings
{
if (self::$instance) {
return self::$instance;
}
return self::$instance = new ilAuthLogoutPageEditorSettings();
return self::$instance ?? new ilAuthLogoutPageEditorSettings();
}

protected function getStorage(): ilSetting
{
return $this->storage;
}

public function setMode(int $a_mode): void
{
$this->mode = $a_mode;
}

public function getMode(): int
{
return $this->mode;
}

public function getIliasEditorLanguage(string $a_langkey): string
{
if ($this->isIliasEditorEnabled($a_langkey)) {
Expand All @@ -86,20 +70,16 @@ public function isIliasEditorEnabled(string $a_langkey): bool

public function update(): void
{
$this->getStorage()->set('mode', (string) $this->getMode());

foreach ($this->languages as $lngkey => $stat) {
$this->storage->set($lngkey, (string) $stat);
}
}

public function read(): void
{
$this->setMode((int) $this->getStorage()->get('mode', (string) self::MODE_IPE));

$this->languages = [];
foreach ($this->lng->getInstalledLanguages() as $lngkey) {
$this->enableIliasEditor($lngkey, (bool) $this->getStorage()->get($lngkey, ""));
$this->enableIliasEditor($lngkey, (bool) $this->getStorage()->get($lngkey, ''));
}
}
}
Loading