ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLearningSequenceLearnerGUI Class Reference

Class ilObjLearningSequenceLearnerGUI. More...

+ Collaboration diagram for ilObjLearningSequenceLearnerGUI:

Public Member Functions

 __construct (int $ls_ref_id, $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,
  $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.

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

32  {
33  $this->ls_object = $ls_object;
34  $this->ls_ref_id = $ls_ref_id;
35  $this->first_access = $first_access;
36  $this->usr_id = $usr_id;
37  $this->access = $access;
38  $this->ctrl = $ctrl;
39  $this->lng = $lng;
40  $this->tpl = $tpl;
41  $this->toolbar = $toolbar;
42  $this->ui_factory = $ui_factory;
43  $this->renderer = $ui_renderer;
44  $this->roles = $roles;
45  $this->settings = $settings;
46  $this->curriculum_builder = $curriculum_builder;
47  $this->player = $player;
48  }
settings()
Definition: settings.php:2
$lng
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ addMember()

ilObjLearningSequenceLearnerGUI::addMember ( int  $usr_id)
protected

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

Referenced by executeCommand().

102  {
103  $admins = $this->roles->getLearningSequenceAdminIds();
104  if (!in_array($usr_id, $admins)) {
105  $this->roles->join($usr_id);
106  }
107  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjLearningSequenceLearnerGUI::executeCommand ( )

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

References addMember(), LSControlBuilder\CMD_CHECK_CURRENT_ITEM_LP, getCurrentItemLearningProgress(), play(), userMayUnparticipate(), and view().

51  {
52  $cmd = $this->ctrl->getCmd();
53  switch ($cmd) {
54  case self::CMD_STANDARD:
55  case self::CMD_EXTRO:
56  $this->view($cmd);
57  break;
58  case self::CMD_START:
59  $this->addMember($this->usr_id);
60  $this->ctrl->redirect($this, self::CMD_VIEW);
61  break;
62  case self::CMD_UNSUBSCRIBE:
63  if ($this->userMayUnparticipate()) {
64  $this->roles->leave($this->usr_id);
65  }
66  $this->ctrl->redirect($this, self::CMD_STANDARD);
67  break;
68  case self::CMD_VIEW:
69  $this->play();
70  break;
71 
74 
75  // no break
76  default:
77  throw new ilException(
78  "ilObjLearningSequenceLearnerGUI: " .
79  "Command not supported: $cmd"
80  );
81  }
82  }
+ Here is the call graph for this function:

◆ getCurrentItemLearningProgress()

ilObjLearningSequenceLearnerGUI::getCurrentItemLearningProgress ( )
protected

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

References exit.

Referenced by executeCommand().

234  {
235  print $this->player->getCurrentItemLearningProgress();
236  exit;
237  }
exit
Definition: login.php:29
+ Here is the caller graph for this function:

◆ getMainContent()

ilObjLearningSequenceLearnerGUI::getMainContent ( string  $cmd)
private

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

References $img, $txt, and settings().

Referenced by view().

185  : array
186  {
187  if ($cmd === self::CMD_STANDARD) {
188  $txt = $this->settings->getAbstract();
189  $img = $this->settings->getAbstractImage();
190  }
191 
192  if ($cmd === self::CMD_EXTRO) {
193  $txt = $this->settings->getExtro();
194  $img = $this->settings->getExtroImage();
195  }
196 
197  $contents = [$this->ui_factory->legacy($txt)];
198  if (!is_null($img)) {
199  $contents[] = $this->ui_factory->image()->responsive($img, '');
200  }
201 
202  return $contents;
203  }
settings()
Definition: settings.php:2
$txt
Definition: error.php:13
$img
Definition: imgupload.php:57
+ 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 174 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by view().

174  : string
175  {
176  array_unshift(
177  $components,
178  $this->ui_factory->legacy('<div class="ilLSOLearnerView">')
179  );
180  $components[] = $this->ui_factory->legacy('</div>');
181 
182  return $this->renderer->render($components);
183  }
+ Here is the caller graph for this function:

◆ initToolbar()

ilObjLearningSequenceLearnerGUI::initToolbar ( string  $cmd)
protected

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

References ilLinkButton\getInstance(), userMayJoin(), and userMayUnparticipate().

Referenced by view().

121  {
122  $is_member = $this->roles->isMember($this->usr_id);
123  $completed = $this->roles->isCompletedByUser($this->usr_id);
124 
125  if (!$is_member) {
126  $may_subscribe = $this->userMayJoin();
127  if ($may_subscribe) {
128  $sub_button = ilLinkButton::getInstance();
129  $sub_button->setPrimary(true);
130  $sub_button->setCaption("lso_player_start");
131  $sub_button->setUrl($this->ctrl->getLinkTarget($this,self::CMD_START));
132  $this->toolbar->addButtonInstance($sub_button);
133  }
134  } else {
135  if (!$completed) {
136  $res_button = ilLinkButton::getInstance();
137  $res_button->setPrimary(true);
138  $res_button->setCaption("lso_player_resume");
139  if ($this->first_access === -1) {
140  $res_button->setCaption("lso_player_start");
141  }
142  $res_button->setUrl($this->ctrl->getLinkTarget($this, self::CMD_VIEW));
143  $this->toolbar->addButtonInstance($res_button);
144  } else {
145  $review_button = ilLinkButton::getInstance();
146  $review_button->setCaption("lso_player_review");
147  $review_button->setUrl($this->ctrl->getLinkTarget($this, self::CMD_VIEW));
148  $this->toolbar->addButtonInstance($review_button);
149 
150  if ($cmd === self::CMD_STANDARD) {
151  $button = ilLinkButton::getInstance();
152  $button->setCaption("lso_player_extro");
153  $button->setUrl($this->ctrl->getLinkTarget($this, self::CMD_EXTRO));
154  $this->toolbar->addButtonInstance($button);
155  }
156  if ($cmd === self::CMD_EXTRO) {
157  $button = ilLinkButton::getInstance();
158  $button->setCaption("lso_player_abstract");
159  $button->setUrl($this->ctrl->getLinkTarget($this, self::CMD_STANDARD));
160  $this->toolbar->addButtonInstance($button);
161  }
162  }
163 
164  $may_unsubscribe = $this->userMayUnparticipate();
165  if ($may_unsubscribe) {
166  $unsub_button = ilLinkButton::getInstance();
167  $unsub_button->setCaption("unparticipate");
168  $unsub_button->setUrl($this->ctrl->getLinkTarget($this, self::CMD_UNSUBSCRIBE));
169  $this->toolbar->addButtonInstance($unsub_button);
170  }
171  }
172  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ play()

ilObjLearningSequenceLearnerGUI::play ( )
protected

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

References $_GET, $_POST, $response, ilLSPlayer\LSO_CMD_FINISH, ilLSPlayer\LSO_CMD_SUSPEND, ilUtil\redirect(), ilLSPlayer\RET_EXIT, ilLSPlayer\RET_NOITEMS, and ilUtil\sendInfo().

Referenced by executeCommand().

206  {
207  $response = $this->player->play($_GET, $_POST);
208 
209  switch ($response) {
210  case null:
211  $this->tpl->enableDragDropFileUpload(null);
212  $this->tpl->setContent('THIS SHOULD NOT SHOW');
213  return;
214 
216  \ilUtil::sendInfo($this->lng->txt('container_no_items'));
217  $this->tpl->setContent('');
218  return;
219 
221  $cmd = self::CMD_EXTRO;
222  break;
223 
225  default:
226  $cmd = self::CMD_STANDARD;
227  break;
228  }
229  $href = $this->ctrl->getLinkTarget($this, $cmd, '', false, false);
230  \ilUtil::redirect($href);
231  }
$_GET["client_id"]
const LSO_CMD_SUSPEND
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const LSO_CMD_FINISH
static redirect($a_script)
$response
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userMayJoin()

ilObjLearningSequenceLearnerGUI::userMayJoin ( )
protected

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

Referenced by initToolbar().

115  : bool
116  {
117  return $this->access->checkAccess('participate', '', $this->ls_ref_id);
118  }
+ Here is the caller graph for this function:

◆ userMayUnparticipate()

ilObjLearningSequenceLearnerGUI::userMayUnparticipate ( )
protected

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

Referenced by executeCommand(), and initToolbar().

110  : bool
111  {
112  return $this->access->checkAccess('unparticipate', '', $this->ls_ref_id);
113  }
+ Here is the caller graph for this function:

◆ view()

ilObjLearningSequenceLearnerGUI::view ( string  $cmd)
protected

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

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

Referenced by executeCommand().

85  {
86  $this->initToolbar($cmd);
87 
88  $content = $this->getMainContent($cmd);
89  $this->tpl->setContent(
90  $this->getWrappedHTML($content)
91  );
92 
93  $curriculum = $this->curriculum_builder->getLearnerCurriculum();
94  if (count($curriculum->getSteps()) > 0) {
95  $this->tpl->setRightContent(
96  $this->getWrappedHTML([$curriculum])
97  );
98  }
99  }
+ 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.

◆ CMD_STANDARD

const ilObjLearningSequenceLearnerGUI::CMD_STANDARD = 'learnerView'

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

◆ CMD_START

const ilObjLearningSequenceLearnerGUI::CMD_START = 'start'

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

◆ CMD_UNSUBSCRIBE

const ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE = 'unsubscribe'

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

◆ CMD_VIEW

const ilObjLearningSequenceLearnerGUI::CMD_VIEW = 'view'

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

Referenced by 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: