ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjLearningSequenceLearnerGUI Class Reference

Class ilObjLearningSequenceLearnerGUI. More...

+ Collaboration diagram for ilObjLearningSequenceLearnerGUI:

Public Member Functions

 __construct (int $ls_ref_id, bool $has_items, $first_access, int $usr_id, ilAccess $access, ilCtrl $ctrl, ilLanguage $lng, ilGlobalTemplateInterface $tpl, ilToolbarGUI $toolbar, ILIAS\UI\Factory $ui_factory, ILIAS\UI\Renderer $ui_renderer, ilLearningSequenceRoles $roles, ilLearningSequenceSettings $settings, ilLSCurriculumBuilder $curriculum_builder, ilLSPlayer $player)
 
 executeCommand ()
 

Data Fields

const CMD_STANDARD = 'learnerView'
 
const CMD_EXTRO = 'learnerViewFinished'
 
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

 view (string $cmd)
 
 addMember (int $usr_id)
 
 userMayUnparticipate ()
 
 userMayJoin ()
 
 initToolbar (string $cmd)
 
 play ()
 
 getCurrentItemLearningProgress ()
 

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceLearnerGUI::__construct ( int  $ls_ref_id,
bool  $has_items,
  $first_access,
int  $usr_id,
ilAccess  $access,
ilCtrl  $ctrl,
ilLanguage  $lng,
ilGlobalTemplateInterface  $tpl,
ilToolbarGUI  $toolbar,
ILIAS\UI\Factory  $ui_factory,
ILIAS\UI\Renderer  $ui_renderer,
ilLearningSequenceRoles  $roles,
ilLearningSequenceSettings  $settings,
ilLSCurriculumBuilder  $curriculum_builder,
ilLSPlayer  $player 
)

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

33 {
34 $this->ls_object = $ls_object;
35 $this->ls_ref_id = $ls_ref_id;
36 $this->has_items = $has_items;
37 $this->first_access = $first_access;
38 $this->usr_id = $usr_id;
39 $this->access = $access;
40 $this->ctrl = $ctrl;
41 $this->lng = $lng;
42 $this->tpl = $tpl;
43 $this->toolbar = $toolbar;
44 $this->ui_factory = $ui_factory;
45 $this->renderer = $ui_renderer;
46 $this->roles = $roles;
47 $this->settings = $settings;
48 $this->curriculum_builder = $curriculum_builder;
49 $this->player = $player;
50 }
$lng
settings()
Definition: settings.php:2
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $lng, $tpl, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addMember()

ilObjLearningSequenceLearnerGUI::addMember ( int  $usr_id)
protected

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

104 {
105 $admins = $this->roles->getLearningSequenceAdminIds();
106 if (!in_array($usr_id, $admins)) {
107 $this->roles->join($usr_id);
108 }
109 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilObjLearningSequenceLearnerGUI::executeCommand ( )

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

53 {
54 $cmd = $this->ctrl->getCmd();
55 switch ($cmd) {
57 case self::CMD_EXTRO:
58 $this->view($cmd);
59 break;
60 case self::CMD_START:
61 $this->addMember($this->usr_id);
62 $this->ctrl->redirect($this, self::CMD_VIEW);
63 break;
65 if ($this->userMayUnparticipate()) {
66 $this->roles->leave($this->usr_id);
67 }
68 $this->ctrl->redirect($this, self::CMD_STANDARD);
69 break;
70 case self::CMD_VIEW:
71 $this->play();
72 break;
73
76
77 // no break
78 default:
79 throw new ilException(
80 "ilObjLearningSequenceLearnerGUI: " .
81 "Command not supported: $cmd"
82 );
83 }
84 }
Base class for ILIAS Exception handling.

References addMember(), LSControlBuilder\CMD_CHECK_CURRENT_ITEM_LP, CMD_EXTRO, CMD_STANDARD, CMD_START, CMD_UNSUBSCRIBE, CMD_VIEW, getCurrentItemLearningProgress(), play(), userMayUnparticipate(), and view().

+ Here is the call graph for this function:

◆ getCurrentItemLearningProgress()

ilObjLearningSequenceLearnerGUI::getCurrentItemLearningProgress ( )
protected

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

238 {
239 print $this->player->getCurrentItemLearningProgress();
240 exit;
241 }
if(! $in) print
exit
Definition: login.php:29

References exit, and print.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getMainContent()

ilObjLearningSequenceLearnerGUI::getMainContent ( string  $cmd)
private

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

193 : array
194 {
195 if ($cmd === self::CMD_STANDARD) {
196 $txt = $this->settings->getAbstract();
197 $img = $this->settings->getAbstractImage();
198 }
199
200 if ($cmd === self::CMD_EXTRO) {
201 $txt = $this->settings->getExtro();
202 $img = $this->settings->getExtroImage();
203 }
204
205 $contents = [$this->ui_factory->legacy($txt)];
206 if (!is_null($img)) {
207 $contents[] = $this->ui_factory->image()->responsive($img, '');
208 }
209
210 return $contents;
211 }
$txt
Definition: error.php:13

References $img, $txt, and 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 182 of file class.ilObjLearningSequenceLearnerGUI.php.

182 : string
183 {
184 array_unshift(
185 $components,
186 $this->ui_factory->legacy('<div class="ilLSOLearnerView">')
187 );
188 $components[] = $this->ui_factory->legacy('</div>');
189
190 return $this->renderer->render($components);
191 }

Referenced by view().

+ Here is the caller graph for this function:

◆ initToolbar()

ilObjLearningSequenceLearnerGUI::initToolbar ( string  $cmd)
protected

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

123 {
124 $is_member = $this->roles->isMember($this->usr_id);
125 $completed = $this->roles->isCompletedByUser($this->usr_id);
126 $has_items = $this->has_items;
127
128 if (!$is_member) {
129 if ($has_items) {
130 $may_subscribe = $this->userMayJoin();
131 if ($may_subscribe) {
132 $this->toolbar->addButton(
133 $this->lng->txt("lso_player_start"),
134 $this->ctrl->getLinkTarget($this, self::CMD_START)
135 );
136 }
137 }
138 } else {
139 if (!$completed) {
140 if ($has_items) {
141 $label = "lso_player_resume";
142 if ($this->first_access === -1) {
143 $label = "lso_player_start";
144 }
145
146 $this->toolbar->addButton(
147 $this->lng->txt($label),
148 $this->ctrl->getLinkTarget($this, self::CMD_VIEW)
149 );
150 }
151 } else {
152 if ($has_items) {
153 $this->toolbar->addButton(
154 $this->lng->txt("lso_player_review"),
155 $this->ctrl->getLinkTarget($this, self::CMD_VIEW)
156 );
157 }
158 if ($cmd === self::CMD_STANDARD) {
159 $this->toolbar->addButton(
160 $this->lng->txt("lso_player_extro"),
161 $this->ctrl->getLinkTarget($this, self::CMD_EXTRO)
162 );
163 }
164 if ($cmd === self::CMD_EXTRO) {
165 $this->toolbar->addButton(
166 $this->lng->txt("lso_player_abstract"),
167 $this->ctrl->getLinkTarget($this, self::CMD_STANDARD)
168 );
169 }
170 }
171
172 $may_unsubscribe = $this->userMayUnparticipate();
173 if ($may_unsubscribe) {
174 $this->toolbar->addButton(
175 $this->lng->txt("unparticipate"),
176 $this->ctrl->getLinkTarget($this, self::CMD_UNSUBSCRIBE)
177 );
178 }
179 }
180 }

References userMayJoin(), and userMayUnparticipate().

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 213 of file class.ilObjLearningSequenceLearnerGUI.php.

214 {
215 $response = $this->player->play($_GET, $_POST);
216
217 switch ($response) {
218 case null:
219 //render the page
220 $this->tpl->enableDragDropFileUpload(null);
221 $this->tpl->setContent('THIS SHOULD NOT SHOW');
222 return;
223
224 case 'EXIT::' . $this->player::LSO_CMD_FINISH:
225 $cmd = self::CMD_EXTRO;
226 break;
227
228 case 'EXIT::' . $this->player::LSO_CMD_SUSPEND:
229 default:
230 $cmd = self::CMD_STANDARD;
231 break;
232 }
233 $href = $this->ctrl->getLinkTarget($this, $cmd, '', false, false);
234 \ilUtil::redirect($href);
235 }
$_GET["client_id"]
$_POST["username"]
static redirect($a_script)
$response

References $_GET, $_POST, $response, CMD_EXTRO, CMD_STANDARD, and ilUtil\redirect().

Referenced by executeCommand().

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

◆ userMayJoin()

ilObjLearningSequenceLearnerGUI::userMayJoin ( )
protected

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

117 : bool
118 {
119 return $this->access->checkAccess('participate', '', $this->ls_ref_id);
120 }

Referenced by initToolbar().

+ Here is the caller graph for this function:

◆ userMayUnparticipate()

ilObjLearningSequenceLearnerGUI::userMayUnparticipate ( )
protected

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

112 : bool
113 {
114 return $this->access->checkAccess('unparticipate', '', $this->ls_ref_id);
115 }

Referenced by executeCommand(), and initToolbar().

+ Here is the caller graph for this function:

◆ view()

ilObjLearningSequenceLearnerGUI::view ( string  $cmd)
protected

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

87 {
88 $this->initToolbar($cmd);
89
90 $content = $this->getMainContent($cmd);
91 $this->tpl->setContent(
92 $this->getWrappedHTML($content)
93 );
94
95 $curriculum = $this->curriculum_builder->getLearnerCurriculum();
96 if (count($curriculum->getSteps()) > 0) {
97 $this->tpl->setRightContent(
98 $this->getWrappedHTML([$curriculum])
99 );
100 }
101 }

References getMainContent(), getWrappedHTML(), and initToolbar().

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 9 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by executeCommand(), and play().

◆ CMD_STANDARD

const ilObjLearningSequenceLearnerGUI::CMD_STANDARD = 'learnerView'

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

Referenced by executeCommand(), and play().

◆ CMD_START

const ilObjLearningSequenceLearnerGUI::CMD_START = 'start'

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

Referenced by executeCommand().

◆ CMD_UNSUBSCRIBE

const ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE = 'unsubscribe'

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

Referenced by executeCommand().

◆ CMD_VIEW

const ilObjLearningSequenceLearnerGUI::CMD_VIEW = 'view'

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

Referenced by executeCommand(), and ilLSLocalDI\init().

◆ LSO_CMD_NEXT

const ilObjLearningSequenceLearnerGUI::LSO_CMD_NEXT = 'lson'

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

◆ LSO_CMD_PREV

const ilObjLearningSequenceLearnerGUI::LSO_CMD_PREV = 'lsop'

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

◆ PARAM_LSO_NEXT_ITEM

const ilObjLearningSequenceLearnerGUI::PARAM_LSO_NEXT_ITEM = 'lsoni'

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


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