3 declare(strict_types=1);
39 $this->ls_object = $ls_object;
40 $this->usr_id = $usr_id;
42 $this->current_item = $current_item;
46 $this->toolbar = $toolbar;
47 $this->ui_factory = $ui_factory;
48 $this->renderer = $ui_renderer;
53 $cmd = $this->ctrl->getCmd();
55 case self::CMD_STANDARD:
61 $this->ctrl->redirect($this, self::CMD_VIEW);
63 case self::CMD_UNSUBSCRIBE:
64 if ($this->ls_object->userMayUnparticipate()) {
67 $this->ctrl->redirect($this, self::CMD_STANDARD);
75 "ilObjLearningSequenceLearnerGUI: " .
76 "Command not supported: $cmd" 81 protected function view(
string $cmd)
87 $this->tpl->setContent($content);
88 $this->tpl->setRightContent($curriculum);
93 $admins = $this->ls_object->getLearningSequenceAdminIds();
94 if (!in_array($usr_id, $admins)) {
95 $this->ls_object->join($usr_id);
101 $this->ls_object->leave($usr_id);
106 $is_member = $this->ls_object->isMember($this->usr_id);
107 $completed = $this->ls_object->isCompletedByUser($this->usr_id);
108 $has_items = count($this->ls_learner_items) > 0;
112 $may_subscribe = $this->ls_object->userMayJoin();
113 if ($may_subscribe) {
114 $this->toolbar->addButton(
115 $this->lng->txt(
"lso_player_start"),
116 $this->ctrl->getLinkTarget($this, self::CMD_START)
123 $state_db = $this->ls_object->getStateDB();
124 $obj_ref_id = (int) $this->ls_object->getRefId();
125 $first_access = $state_db->getFirstAccessFor(
130 $label =
"lso_player_resume";
131 if ($first_access === -1) {
132 $label =
"lso_player_start";
135 $this->toolbar->addButton(
136 $this->lng->txt($label),
137 $this->ctrl->getLinkTarget($this, self::CMD_VIEW)
142 $this->toolbar->addButton(
143 $this->lng->txt(
"lso_player_review"),
144 $this->ctrl->getLinkTarget($this, self::CMD_VIEW)
147 if ($cmd === self::CMD_STANDARD) {
148 $this->toolbar->addButton(
149 $this->lng->txt(
"lso_player_extro"),
150 $this->ctrl->getLinkTarget($this, self::CMD_EXTRO)
153 if ($cmd === self::CMD_EXTRO) {
154 $this->toolbar->addButton(
155 $this->lng->txt(
"lso_player_abstract"),
156 $this->ctrl->getLinkTarget($this, self::CMD_STANDARD)
161 $may_unsubscribe = $this->ls_object->userMayUnparticipate();
162 if ($may_unsubscribe) {
163 $this->toolbar->addButton(
164 $this->lng->txt(
"unparticipate"),
165 $this->ctrl->getLinkTarget($this, self::CMD_UNSUBSCRIBE)
175 $this->ui_factory->legacy(
'<div class="ilLSOLearnerView">')
177 $components[] = $this->ui_factory->legacy(
'</div>');
179 return $this->renderer->render($components);
184 $current_position = 0;
185 foreach ($this->ls_learner_items as
$index => $item) {
186 if ($item->getRefId() === $this->current_item) {
187 $current_position =
$index;
191 $curriculum = $this->ls_object
192 ->getCurriculumBuilder($this->ls_learner_items)
193 ->getLearnerCurriculum();
195 if (count($this->ls_learner_items) > 0) {
196 $curriculum = $curriculum->withActive($current_position);
198 return array($curriculum);
203 $settings = $this->ls_object->getLSSettings();
205 if ($cmd === self::CMD_STANDARD) {
206 $txt = $settings->getAbstract();
207 $img = $settings->getAbstractImage();
210 if ($cmd === self::CMD_EXTRO) {
211 $txt = $settings->getExtro();
212 $img = $settings->getExtroImage();
215 $contents = [$this->ui_factory->legacy(
$txt)];
216 if (!is_null(
$img)) {
217 $contents[] = $this->ui_factory->image()->responsive(
$img,
'');
236 $player = $this->ls_object->getSequencePlayer(
243 if (
$html ===
'EXIT::' . $player::LSO_CMD_SUSPEND) {
244 $cmd = self::CMD_STANDARD;
246 if (
$html ===
'EXIT::' . $player::LSO_CMD_FINISH) {
247 $cmd = self::CMD_EXTRO;
249 if (is_null(
$html)) {
250 $cmd = self::CMD_STANDARD;
259 $href = $this->ctrl->getLinkTarget($this, $cmd,
'',
false,
false);
An entity that renders components to a string output.
This class provides processing control methods.
getWrappedHTML(array $components)
const PARAM_LSO_NEXT_ITEM
Class ilObjLearningSequence.
Class ilObjLearningSequenceLearnerGUI.
__construct(ilObjLearningSequence $ls_object, int $usr_id, array $ls_learner_items, int $current_item, ilCtrl $ctrl, ilLanguage $lng, ilTemplate $tpl, ilToolbarGUI $toolbar, ILIAS\UI\Factory $ui_factory, ILIAS\UI\Renderer $ui_renderer)
This is how the factory for UI elements looks.
special template class to simplify handling of ITX/PEAR
getMainContent(string $cmd)
removeMember(int $usr_id)
static redirect($a_script)