ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 = '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)
 
 initToolbar (string $cmd)
 
 play ()
 

Private Member Functions

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

Detailed Description

Definition at line 23 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 34 of file class.ilObjLearningSequenceLearnerGUI.php.

51  {
52  }

Member Function Documentation

◆ addMember()

ilObjLearningSequenceLearnerGUI::addMember ( int  $usr_id)
protected

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

Referenced by executeCommand().

106  : void
107  {
108  $admins = $this->roles->getLearningSequenceAdminIds();
109  if (!in_array($usr_id, $admins)) {
110  $this->roles->join($usr_id);
111  }
112  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjLearningSequenceLearnerGUI::executeCommand ( )

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

References addMember(), ILIAS\Repository\ctrl(), play(), and view().

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

◆ getMainContent()

ilObjLearningSequenceLearnerGUI::getMainContent ( string  $cmd)
private

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

References null, and ILIAS\Repository\settings().

Referenced by view().

139  : array
140  {
141  $img = null;
142  $contents = [];
143 
144  if ($cmd === self::CMD_STANDARD) {
145  if ($this->intro === '') {
146  $contents[] = $this->ui_factory->legacy()->content($this->settings->getAbstract());
147  $img = $this->settings->getAbstractImage();
148  if ($img) {
149  $contents[] = $this->ui_factory->image()->responsive($img, '');
150  }
151  } else {
152  $contents[] = $this->ui_factory->legacy()->content($this->intro);
153  }
154  }
155 
156  if ($cmd === self::CMD_EXTRO) {
157  if ($this->extro === '') {
158  $contents[] = $this->ui_factory->legacy()->content($this->settings->getExtro());
159  $img = $this->settings->getExtroImage();
160  if ($img) {
161  $contents[] = $this->ui_factory->image()->responsive($img, '');
162  }
163  } else {
164  $contents[] = $this->ui_factory->legacy()->content($this->extro);
165  }
166  }
167  return $contents;
168  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 128 of file class.ilObjLearningSequenceLearnerGUI.php.

References renderer().

Referenced by view().

128  : string
129  {
130  array_unshift(
131  $components,
132  $this->ui_factory->legacy()->content('<div class="ilLSOLearnerView">')
133  );
134  $components[] = $this->ui_factory->legacy()->content('</div>');
135 
136  return $this->renderer->render($components);
137  }
renderer()
$components
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initToolbar()

ilObjLearningSequenceLearnerGUI::initToolbar ( string  $cmd)
protected

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

References ILIAS\Repository\toolbar().

Referenced by view().

115  {
116  foreach ($this->launchlinks_builder->getLinks() as $entry) {
117  list($label, $link, $primary) = $entry;
118 
119  if ($primary) {
120  $btn = $this->ui_factory->button()->primary($label, $link);
121  } else {
122  $btn = $this->ui_factory->button()->standard($label, $link);
123  }
124  $this->toolbar->addComponent($btn);
125  }
126  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ play()

ilObjLearningSequenceLearnerGUI::play ( )
protected

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

References $response, ILIAS\Repository\ctrl(), null, and ilUtil\redirect().

Referenced by executeCommand().

170  : void
171  {
172  $response = $this->player->play($this->get);
173 
174  switch ($response) {
175  case null:
176  //render the page
177  $this->tpl->setContent('THIS SHOULD NOT SHOW');
178  return;
179 
180  case 'EXIT::' . $this->player::LSO_CMD_FINISH:
181  $cmd = self::CMD_EXTRO;
182  break;
183 
184  case 'EXIT::' . $this->player::LSO_CMD_SUSPEND:
185  default:
186  $cmd = self::CMD_STANDARD;
187  break;
188  }
189  $href = $this->ctrl->getLinkTarget($this, $cmd, '', false, false);
190  \ilUtil::redirect($href);
191  }
$response
Definition: xapitoken.php:93
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static redirect(string $a_script)
+ 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 84 of file class.ilObjLearningSequenceLearnerGUI.php.

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

Referenced by executeCommand().

84  : void
85  {
86  $content = $this->getWrappedHTML(
87  $this->getMainContent($cmd)
88  );
89 
90  $this->tpl->setContent($content);
91 
92  $element = '<' . ilPCLauncher::PCELEMENT . '>';
93  if (!str_contains($content, $element)) {
94  $this->initToolbar($cmd);
95  }
96 
97  $element = '<' . ilPCCurriculum::PCELEMENT . '>';
98  if (!str_contains($content, $element)) {
99  $curriculum = $this->curriculum_builder->getLearnerCurriculum();
100  $this->tpl->setRightContent(
101  $this->getWrappedHTML([$curriculum])
102  );
103  }
104  }
+ 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 26 of file class.ilObjLearningSequenceLearnerGUI.php.

◆ CMD_STANDARD

const ilObjLearningSequenceLearnerGUI::CMD_STANDARD = 'learnerView'

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

◆ CMD_START

const ilObjLearningSequenceLearnerGUI::CMD_START = 'start'

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

◆ CMD_UNSUBSCRIBE

const ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE = 'unsubscribe'

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

◆ CMD_VIEW

const ilObjLearningSequenceLearnerGUI::CMD_VIEW = 'view'

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

Referenced by ilLSLocalDI\init().

◆ LSO_CMD_NEXT

const ilObjLearningSequenceLearnerGUI::LSO_CMD_NEXT = 'lson'

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

◆ LSO_CMD_PREV

const ilObjLearningSequenceLearnerGUI::LSO_CMD_PREV = 'lsop'

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

◆ PARAM_LSO_NEXT_ITEM

const ilObjLearningSequenceLearnerGUI::PARAM_LSO_NEXT_ITEM = 'lsoni'

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


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