Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -32,7 +32,7 @@ class ilLSLaunchlinksBuilder
public const CMD_EXTRO = ilObjLearningSequenceLearnerGUI::CMD_EXTRO;
public const CMD_START = ilObjLearningSequenceLearnerGUI::CMD_START;
public const CMD_VIEW = ilObjLearningSequenceLearnerGUI::CMD_VIEW;
public const CMD_UNSUBSCRIBE = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE;
public const CMD_UNSUBSCRIBE_CONFIRMATION = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE_CONFIRMATION;

public function __construct(
protected ilLanguage $lng,
Expand Down Expand Up @@ -131,7 +131,7 @@ public function getLinks(): array
if ($this->mayUnparticipate()) {
$links[] = [
$this->lng->txt("unparticipate"),
$this->getLink(self::CMD_UNSUBSCRIBE),
$this->getLink(self::CMD_UNSUBSCRIBE_CONFIRMATION),
false
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
declare(strict_types=1);

use ILIAS\HTTP\Wrapper\RequestWrapper;
use ILIAS\UI\Component\Modal\Interruptive;

class ilObjLearningSequenceLearnerGUI
{
public const CMD_STANDARD = 'learnerView';
public const CMD_EXTRO = 'learnerViewFinished';
public const CMD_UNSUBSCRIBE_CONFIRMATION = 'unsubscribeConfirmation';
public const CMD_UNSUBSCRIBE = 'unsubscribe';
public const CMD_VIEW = 'view';
public const CMD_START = 'start';
Expand Down Expand Up @@ -63,6 +65,9 @@ public function executeCommand(): void
$this->addMember($this->usr_id);
$this->ctrl->redirect($this, self::CMD_VIEW);
break;
case self::CMD_UNSUBSCRIBE_CONFIRMATION:
$this->unsubscribeConfirmationModal();
break;
case self::CMD_UNSUBSCRIBE:
if ($this->launchlinks_builder->currentUserMayUnparticipate()) {
$this->roles->leave($this->usr_id);
Expand All @@ -81,17 +86,28 @@ public function executeCommand(): void
}
}

protected function unsubscribeConfirmationModal(): Interruptive
{
return $this->ui_factory->modal()->interruptive(
$this->lng->txt('obj_lso'),
$this->lng->txt("unparticipate"),
$this->ctrl->getLinkTarget($this, self::CMD_UNSUBSCRIBE),
);
}

protected function view(string $cmd): void
{
$content = $this->getWrappedHTML(
$this->getMainContent($cmd)
);

$this->tpl->setContent($content);
$modal = $this->unsubscribeConfirmationModal();

$this->tpl->setContent($content . $this->renderer->render($modal));

$element = '<' . ilPCLauncher::PCELEMENT . '>';
if (!str_contains($content, $element)) {
$this->initToolbar($cmd);
$this->initToolbar($cmd, $modal);
}

$element = '<' . ilPCCurriculum::PCELEMENT . '>';
Expand All @@ -111,7 +127,7 @@ protected function addMember(int $usr_id): void
}
}

protected function initToolbar(string $cmd)
protected function initToolbar(string $cmd, Interruptive $modal): void
{
foreach ($this->launchlinks_builder->getLinks() as $entry) {
list($label, $link, $primary) = $entry;
Expand All @@ -121,6 +137,11 @@ protected function initToolbar(string $cmd)
} else {
$btn = $this->ui_factory->button()->standard($label, $link);
}

if ($label === $this->lng->txt("unparticipate")) {
$btn = $this->ui_factory->button()->standard($label, $link)->withOnClick($modal->getShowSignal());
}

$this->toolbar->addComponent($btn);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -11218,7 +11218,7 @@ lso#:#table_online#:#Online
lso#:#table_position#:#Position
lso#:#table_sequence_content#:#Inhaltsverwaltung
lso#:#table_title#:#Titel
lso#:#unparticipate#:#Lernsequenz verlassen
lso#:#unparticipate#:#Mitgliedschaft in der Lernsequenz beenden
lti#:#act_lti_for_obj_type#:#LTI für diese Objekttypen aktivieren
lti#:#activity_id#:#Activity-ID
lti#:#activity_id_info#:#Diese Activity-ID wird vom LTI-Provider verwendet, um Statements zu identifizieren.
Expand Down
Loading