ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLearningSequenceLearnerGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceLearnerGUI:

Public Member Functions

 __construct (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, ilLSLaunchlinksBuilder $launchlinks_builder, ilLSPlayer $player, string $intro, string $extro, 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 ()
 

Protected Attributes

ilAccess $access
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $renderer
 
ilLearningSequenceRoles $roles
 
ilLearningSequenceSettings $settings
 
ilLSCurriculumBuilder $curriculum_builder
 
ilLSLaunchlinksBuilder $launchlinks_builder
 
ilLSPlayer $player
 
string $intro
 
string $extro
 
RequestWrapper $get
 

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 ( 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,
ilLSLaunchlinksBuilder  $launchlinks_builder,
ilLSPlayer  $player,
string  $intro,
string  $extro,
RequestWrapper  $get 
)

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

References $access, $ctrl, $curriculum_builder, $extro, $get, $intro, $launchlinks_builder, $lng, $player, $roles, $settings, $toolbar, $tpl, $ui_factory, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ILIAS\Repository\toolbar().

69  {
70  $this->usr_id = $usr_id;
71  $this->access = $access;
72  $this->ctrl = $ctrl;
73  $this->lng = $lng;
74  $this->tpl = $tpl;
75  $this->toolbar = $toolbar;
76  $this->ui_factory = $ui_factory;
77  $this->renderer = $ui_renderer;
78  $this->roles = $roles;
79  $this->settings = $settings;
80  $this->curriculum_builder = $curriculum_builder;
81  $this->launchlinks_builder = $launchlinks_builder;
82  $this->player = $player;
83  $this->intro = $intro;
84  $this->extro = $extro;
85  $this->get = $get;
86  }
+ Here is the call graph for this function:

Member Function Documentation

◆ addMember()

ilObjLearningSequenceLearnerGUI::addMember ( int  $usr_id)
protected

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

Referenced by executeCommand().

140  : void
141  {
142  $admins = $this->roles->getLearningSequenceAdminIds();
143  if (!in_array($usr_id, $admins)) {
144  $this->roles->join($usr_id);
145  }
146  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjLearningSequenceLearnerGUI::executeCommand ( )

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

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

88  : void
89  {
90  $cmd = $this->ctrl->getCmd();
91  switch ($cmd) {
92  case self::CMD_STANDARD:
93  case self::CMD_EXTRO:
94  $this->view($cmd);
95  break;
96  case self::CMD_START:
97  $this->addMember($this->usr_id);
98  $this->ctrl->redirect($this, self::CMD_VIEW);
99  break;
100  case self::CMD_UNSUBSCRIBE:
101  if ($this->launchlinks_builder->currentUserMayUnparticipate()) {
102  $this->roles->leave($this->usr_id);
103  }
104  $this->ctrl->redirect($this, self::CMD_STANDARD);
105  break;
106  case self::CMD_VIEW:
107  $this->play();
108  break;
109 
110  default:
111  throw new ilException(
112  "ilObjLearningSequenceLearnerGUI: " .
113  "Command not supported: $cmd"
114  );
115  }
116  }
+ Here is the call graph for this function:

◆ getMainContent()

ilObjLearningSequenceLearnerGUI::getMainContent ( string  $cmd)
private

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

References $img, and ILIAS\Repository\settings().

Referenced by view().

171  : array
172  {
173  $img = null;
174  $contents = [];
175 
176  if ($cmd === self::CMD_STANDARD) {
177  if ($this->intro === '') {
178  $contents[] = $this->ui_factory->legacy($this->settings->getAbstract());
179  $img = $this->settings->getAbstractImage();
180  if ($img) {
181  $contents[] = $this->ui_factory->image()->responsive($img, '');
182  }
183  } else {
184  $contents[] = $this->ui_factory->legacy($this->intro);
185  }
186  }
187 
188  if ($cmd === self::CMD_EXTRO) {
189  if ($this->extro === '') {
190  $contents[] = $this->ui_factory->legacy($this->settings->getExtro());
191  $img = $this->settings->getExtroImage();
192  if ($img) {
193  $contents[] = $this->ui_factory->image()->responsive($img, '');
194  }
195  } else {
196  $contents[] = $this->ui_factory->legacy($this->extro);
197  }
198  }
199  return $contents;
200  }
$img
Definition: imgupload.php:83
+ 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 160 of file class.ilObjLearningSequenceLearnerGUI.php.

Referenced by view().

160  : string
161  {
162  array_unshift(
163  $components,
164  $this->ui_factory->legacy('<div class="ilLSOLearnerView">')
165  );
166  $components[] = $this->ui_factory->legacy('</div>');
167 
168  return $this->renderer->render($components);
169  }
+ Here is the caller graph for this function:

◆ initToolbar()

ilObjLearningSequenceLearnerGUI::initToolbar ( string  $cmd)
protected

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

References ilLinkButton\getInstance(), and ILIAS\Repository\toolbar().

Referenced by view().

149  {
150  foreach ($this->launchlinks_builder->getLinks() as $entry) {
151  list($label, $link, $primary) = $entry;
152  $sub_button = ilLinkButton::getInstance();
153  $sub_button->setPrimary($primary);
154  $sub_button->setCaption($label, false);
155  $sub_button->setUrl($link);
156  $this->toolbar->addButtonInstance($sub_button);
157  }
158  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ play()

ilObjLearningSequenceLearnerGUI::play ( )
protected

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

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

Referenced by executeCommand().

202  : void
203  {
204  $response = $this->player->play($this->get);
205 
206  switch ($response) {
207  case null:
208  //render the page
209  $this->tpl->setContent('THIS SHOULD NOT SHOW');
210  return;
211 
212  case 'EXIT::' . $this->player::LSO_CMD_FINISH:
213  $cmd = self::CMD_EXTRO;
214  break;
215 
216  case 'EXIT::' . $this->player::LSO_CMD_SUSPEND:
217  default:
218  $cmd = self::CMD_STANDARD;
219  break;
220  }
221  $href = $this->ctrl->getLinkTarget($this, $cmd, '', false, false);
222  \ilUtil::redirect($href);
223  }
static redirect(string $a_script)
$response
+ 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 118 of file class.ilObjLearningSequenceLearnerGUI.php.

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

Referenced by executeCommand().

118  : void
119  {
120  $content = $this->getWrappedHTML(
121  $this->getMainContent($cmd)
122  );
123 
124  $this->tpl->setContent($content);
125 
126  $element = '<' . ilPCLauncher::PCELEMENT . '>';
127  if (!str_contains($content, $element)) {
128  $this->initToolbar($cmd);
129  }
130 
131  $element = '<' . ilPCCurriculum::PCELEMENT . '>';
132  if (!str_contains($content, $element)) {
133  $curriculum = $this->curriculum_builder->getLearnerCurriculum();
134  $this->tpl->setRightContent(
135  $this->getWrappedHTML([$curriculum])
136  );
137  }
138  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccess ilObjLearningSequenceLearnerGUI::$access
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilObjLearningSequenceLearnerGUI::$ctrl
protected

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

Referenced by __construct().

◆ $curriculum_builder

ilLSCurriculumBuilder ilObjLearningSequenceLearnerGUI::$curriculum_builder
protected

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

Referenced by __construct().

◆ $extro

string ilObjLearningSequenceLearnerGUI::$extro
protected

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

Referenced by __construct().

◆ $get

RequestWrapper ilObjLearningSequenceLearnerGUI::$get
protected

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

Referenced by __construct().

◆ $intro

string ilObjLearningSequenceLearnerGUI::$intro
protected

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

Referenced by __construct().

◆ $launchlinks_builder

ilLSLaunchlinksBuilder ilObjLearningSequenceLearnerGUI::$launchlinks_builder
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilObjLearningSequenceLearnerGUI::$lng
protected

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

Referenced by __construct().

◆ $player

ilLSPlayer ilObjLearningSequenceLearnerGUI::$player
protected

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

Referenced by __construct().

◆ $renderer

ILIAS UI Renderer ilObjLearningSequenceLearnerGUI::$renderer
protected

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

◆ $roles

ilLearningSequenceRoles ilObjLearningSequenceLearnerGUI::$roles
protected

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

Referenced by __construct().

◆ $settings

ilLearningSequenceSettings ilObjLearningSequenceLearnerGUI::$settings
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilObjLearningSequenceLearnerGUI::$toolbar
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilObjLearningSequenceLearnerGUI::$tpl
protected

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

Referenced by __construct().

◆ $ui_factory

ILIAS UI Factory ilObjLearningSequenceLearnerGUI::$ui_factory
protected

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

Referenced by __construct().

◆ 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: