ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ilObjLearningSequenceLearnerGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceLearnerGUI:

Public Member Functions

 __construct (protected int $usr_id, protected ilAccess $access, protected ilCtrl $ctrl, protected ilLanguage $lng, protected ilGlobalTemplateInterface $tpl, protected ilToolbarGUI $toolbar, protected ILIAS\UI\Factory $ui_factory, protected ILIAS\UI\Renderer $renderer, protected ilLearningSequenceRoles $roles, protected ilLearningSequenceSettings $settings, protected ilLSCurriculumBuilder $curriculum_builder, protected ilLSLaunchlinksBuilder $launchlinks_builder, protected ilLSPlayer $player, protected string $intro, protected string $extro, protected RequestWrapper $get)
 
 executeCommand ()
 

Data Fields

const CMD_STANDARD = 'learnerView'
 
const CMD_EXTRO = 'learnerViewFinished'
 
const CMD_UNSUBSCRIBE_CONFIRMATION = 'unsubscribeConfirmation'
 
const CMD_UNSUBSCRIBE = 'unsubscribe'
 
const CMD_VIEW = 'view'
 
const CMD_START = 'start'
 
const PARAM_LSO_NEXT_ITEM = 'lsoni'
 
const LSO_CMD_NEXT = 'lson'
 
const LSO_CMD_PREV = 'lsop'
 

Protected Member Functions

 unsubscribeConfirmationModal ()
 
 view (string $cmd)
 
 addMember (int $usr_id)
 
 initToolbar (string $cmd, Interruptive $modal)
 
 play ()
 

Private Member Functions

 getWrappedHTML (array $components)
 
 getMainContent (string $cmd)
 

Detailed Description

Definition at line 24 of file class.ilObjLearningSequenceLearnerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceLearnerGUI::__construct ( protected int  $usr_id,
protected ilAccess  $access,
protected ilCtrl  $ctrl,
protected ilLanguage  $lng,
protected ilGlobalTemplateInterface  $tpl,
protected ilToolbarGUI  $toolbar,
protected ILIAS\UI\Factory  $ui_factory,
protected ILIAS\UI\Renderer  $renderer,
protected ilLearningSequenceRoles  $roles,
protected ilLearningSequenceSettings  $settings,
protected ilLSCurriculumBuilder  $curriculum_builder,
protected ilLSLaunchlinksBuilder  $launchlinks_builder,
protected ilLSPlayer  $player,
protected string  $intro,
protected string  $extro,
protected RequestWrapper  $get 
)

Definition at line 36 of file class.ilObjLearningSequenceLearnerGUI.php.

53 {
54 }

Member Function Documentation

◆ addMember()

ilObjLearningSequenceLearnerGUI::addMember ( int  $usr_id)
protected

Definition at line 122 of file class.ilObjLearningSequenceLearnerGUI.php.

122 : void
123 {
124 $admins = $this->roles->getLearningSequenceAdminIds();
125 if (!in_array($usr_id, $admins)) {
126 $this->roles->join($usr_id);
127 }
128 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjLearningSequenceLearnerGUI::executeCommand ( )

Definition at line 56 of file class.ilObjLearningSequenceLearnerGUI.php.

56 : void
57 {
58 $cmd = $this->ctrl->getCmd();
59 switch ($cmd) {
61 case self::CMD_EXTRO:
62 $this->view($cmd);
63 break;
64 case self::CMD_START:
65 $this->addMember($this->usr_id);
66 $this->ctrl->redirect($this, self::CMD_VIEW);
67 break;
70 break;
72 if ($this->launchlinks_builder->currentUserMayUnparticipate()) {
73 $this->roles->leave($this->usr_id);
74 }
75 $this->ctrl->redirect($this, self::CMD_STANDARD);
76 break;
77 case self::CMD_VIEW:
78 $this->play();
79 break;
80
81 default:
82 throw new ilException(
83 "ilObjLearningSequenceLearnerGUI: " .
84 "Command not supported: $cmd"
85 );
86 }
87 }
Base class for ILIAS Exception handling.

References addMember(), CMD_EXTRO, CMD_STANDARD, CMD_START, CMD_UNSUBSCRIBE, CMD_UNSUBSCRIBE_CONFIRMATION, CMD_VIEW, ILIAS\Repository\ctrl(), play(), unsubscribeConfirmationModal(), and view().

+ Here is the call graph for this function:

◆ getMainContent()

ilObjLearningSequenceLearnerGUI::getMainContent ( string  $cmd)
private

Definition at line 160 of file class.ilObjLearningSequenceLearnerGUI.php.

160 : array
161 {
162 $img = null;
163 $contents = [];
164
165 if ($cmd === self::CMD_STANDARD) {
166 if ($this->intro === '') {
167 $contents[] = $this->ui_factory->legacy()->content($this->settings->getAbstract());
168 $img = $this->settings->getAbstractImage();
169 if ($img) {
170 $contents[] = $this->ui_factory->image()->responsive($img, '');
171 }
172 } else {
173 $contents[] = $this->ui_factory->legacy()->content($this->intro);
174 }
175 }
176
177 if ($cmd === self::CMD_EXTRO) {
178 if ($this->extro === '') {
179 $contents[] = $this->ui_factory->legacy()->content($this->settings->getExtro());
180 $img = $this->settings->getExtroImage();
181 if ($img) {
182 $contents[] = $this->ui_factory->image()->responsive($img, '');
183 }
184 } else {
185 $contents[] = $this->ui_factory->legacy()->content($this->extro);
186 }
187 }
188 return $contents;
189 }

References ILIAS\Repository\settings().

Referenced by view().

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

◆ getWrappedHTML()

ilObjLearningSequenceLearnerGUI::getWrappedHTML ( array  $components)
private

Definition at line 149 of file class.ilObjLearningSequenceLearnerGUI.php.

149 : string
150 {
151 array_unshift(
153 $this->ui_factory->legacy()->content('<div class="ilLSOLearnerView">')
154 );
155 $components[] = $this->ui_factory->legacy()->content('</div>');
156
157 return $this->renderer->render($components);
158 }
renderer()
$components

References $components, and renderer().

Referenced by view().

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

◆ initToolbar()

ilObjLearningSequenceLearnerGUI::initToolbar ( string  $cmd,
Interruptive  $modal 
)
protected

Definition at line 130 of file class.ilObjLearningSequenceLearnerGUI.php.

130 : void
131 {
132 foreach ($this->launchlinks_builder->getLinks() as $entry) {
133 list($label, $link, $primary) = $entry;
134
135 if ($primary) {
136 $btn = $this->ui_factory->button()->primary($label, $link);
137 } else {
138 $btn = $this->ui_factory->button()->standard($label, $link);
139 }
140
141 if ($label === $this->lng->txt("unparticipate")) {
142 $btn = $this->ui_factory->button()->standard($label, $link)->withOnClick($modal->getShowSignal());
143 }
144
145 $this->toolbar->addComponent($btn);
146 }
147 }
getShowSignal()
Get the signal to show this modal in the frontend.

References ILIAS\UI\Component\Modal\Modal\getShowSignal(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by view().

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

◆ play()

ilObjLearningSequenceLearnerGUI::play ( )
protected

Definition at line 191 of file class.ilObjLearningSequenceLearnerGUI.php.

191 : void
192 {
193 $response = $this->player->play($this->get);
194
195 switch ($response) {
196 case null:
197 //render the page
198 $this->tpl->setContent($this->lng->txt('lso_player_noitems'));
199 return;
200
201 case 'EXIT::' . $this->player::LSO_CMD_FINISH:
202 $cmd = self::CMD_EXTRO;
203 break;
204
205 case 'EXIT::' . $this->player::LSO_CMD_SUSPEND:
206 default:
207 $cmd = self::CMD_STANDARD;
208 break;
209 }
210 $href = $this->ctrl->getLinkTarget($this, $cmd, '', false, false);
211 \ilUtil::redirect($href);
212 }
static redirect(string $a_script)
$response
Definition: xapitoken.php:90

References $response, CMD_EXTRO, CMD_STANDARD, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilUtil\redirect().

Referenced by executeCommand().

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

◆ unsubscribeConfirmationModal()

ilObjLearningSequenceLearnerGUI::unsubscribeConfirmationModal ( )
protected

Definition at line 89 of file class.ilObjLearningSequenceLearnerGUI.php.

90 {
91 return $this->ui_factory->modal()->interruptive(
92 $this->lng->txt('obj_lso'),
93 $this->lng->txt("unparticipate"),
94 $this->ctrl->getLinkTarget($this, self::CMD_UNSUBSCRIBE),
95 );
96 }

References ILIAS\Repository\lng().

Referenced by executeCommand(), and view().

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

◆ view()

ilObjLearningSequenceLearnerGUI::view ( string  $cmd)
protected

Definition at line 98 of file class.ilObjLearningSequenceLearnerGUI.php.

98 : void
99 {
100 $content = $this->getWrappedHTML(
101 $this->getMainContent($cmd)
102 );
103
104 $modal = $this->unsubscribeConfirmationModal();
105
106 $this->tpl->setContent($content . $this->renderer->render($modal));
107
108 $element = '<' . ilPCLauncher::PCELEMENT . '>';
109 if (!str_contains($content, $element)) {
110 $this->initToolbar($cmd, $modal);
111 }
112
113 $element = '<' . ilPCCurriculum::PCELEMENT . '>';
114 if (!str_contains($content, $element)) {
115 $curriculum = $this->curriculum_builder->getLearnerCurriculum();
116 $this->tpl->setRightContent(
117 $this->getWrappedHTML([$curriculum])
118 );
119 }
120 }

References getMainContent(), getWrappedHTML(), initToolbar(), ilPCCurriculum\PCELEMENT, ilPCLauncher\PCELEMENT, renderer(), and unsubscribeConfirmationModal().

Referenced by executeCommand().

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

Field Documentation

◆ CMD_EXTRO

const ilObjLearningSequenceLearnerGUI::CMD_EXTRO = 'learnerViewFinished'

Definition at line 27 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand(), and play().

◆ CMD_STANDARD

const ilObjLearningSequenceLearnerGUI::CMD_STANDARD = 'learnerView'

Definition at line 26 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand(), and play().

◆ CMD_START

const ilObjLearningSequenceLearnerGUI::CMD_START = 'start'

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

Referenced by executeCommand().

◆ CMD_UNSUBSCRIBE

const ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE = 'unsubscribe'

Definition at line 29 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand().

◆ CMD_UNSUBSCRIBE_CONFIRMATION

const ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE_CONFIRMATION = 'unsubscribeConfirmation'

Definition at line 28 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand().

◆ CMD_VIEW

const ilObjLearningSequenceLearnerGUI::CMD_VIEW = 'view'

Definition at line 30 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand().

◆ LSO_CMD_NEXT

const ilObjLearningSequenceLearnerGUI::LSO_CMD_NEXT = 'lson'

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

◆ LSO_CMD_PREV

const ilObjLearningSequenceLearnerGUI::LSO_CMD_PREV = 'lsop'

Definition at line 34 of file class.ilObjLearningSequenceLearnerGUI.php.

◆ PARAM_LSO_NEXT_ITEM

const ilObjLearningSequenceLearnerGUI::PARAM_LSO_NEXT_ITEM = 'lsoni'

Definition at line 32 of file class.ilObjLearningSequenceLearnerGUI.php.


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