ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLSLaunchlinksBuilder Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLSLaunchlinksBuilder:

Public Member Functions

 __construct (ilLanguage $language, ilAccess $access, ilCtrl $ctrl, ILIAS\UI\Factory $ui_factory, int $lso_ref_id, int $usr_id, $first_access, ilLearningSequenceRoles $roles, ilLSLearnerItemsQueries $ls_items)
 
 currentUserMayUnparticipate ()
 
 getLinks ()
 
 getLaunchbuttonsComponent ()
 

Data Fields

const PERM_PARTICIPATE = 'participate'
 
const PERM_UNPARTICIPATE = 'unparticipate'
 
const CMD_STANDARD = ilObjLearningSequenceLearnerGUI::CMD_STANDARD
 
const CMD_EXTRO = ilObjLearningSequenceLearnerGUI::CMD_EXTRO
 
const CMD_START = ilObjLearningSequenceLearnerGUI::CMD_START
 
const CMD_VIEW = ilObjLearningSequenceLearnerGUI::CMD_VIEW
 
const CMD_UNSUBSCRIBE = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE
 

Protected Member Functions

 mayJoin ()
 
 mayUnparticipate ()
 
 isMember ()
 
 hasCompleted ()
 
 getLink (string $cmd)
 

Protected Attributes

ilLanguage $lng
 
ilAccess $access
 
ilCtrl $ctrl
 
ILIAS UI Factory $ui_factory
 
int $lso_ref_id
 
int $usr_id
 
 $first_access
 
ilLearningSequenceRoles $roles
 
ilLSLearnerItemsQueries $ls_items
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Builds the links to join/(re-)start the LearningSequence.

Author
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de

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

Constructor & Destructor Documentation

◆ __construct()

ilLSLaunchlinksBuilder::__construct ( ilLanguage  $language,
ilAccess  $access,
ilCtrl  $ctrl,
ILIAS\UI\Factory  $ui_factory,
int  $lso_ref_id,
int  $usr_id,
  $first_access,
ilLearningSequenceRoles  $roles,
ilLSLearnerItemsQueries  $ls_items 
)

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

References $access, $ctrl, $first_access, $ls_items, $lso_ref_id, $roles, $ui_factory, $usr_id, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

58  {
59  $this->lng = $language;
60  $this->access = $access;
61  $this->ctrl = $ctrl;
62  $this->ui_factory = $ui_factory;
63 
64  $this->lso_ref_id = $lso_ref_id;
65  $this->usr_id = $usr_id;
66  $this->first_access = $first_access;
67  $this->roles = $roles;
68  $this->ls_items = $ls_items;
69  }
ilLSLearnerItemsQueries $ls_items
+ Here is the call graph for this function:

Member Function Documentation

◆ currentUserMayUnparticipate()

ilLSLaunchlinksBuilder::currentUserMayUnparticipate ( )

Definition at line 77 of file class.ilLSLaunchlinksBuilder.php.

References mayUnparticipate().

77  : bool
78  {
79  return $this->mayUnparticipate();
80  }
+ Here is the call graph for this function:

◆ getLaunchbuttonsComponent()

ilLSLaunchlinksBuilder::getLaunchbuttonsComponent ( )

Definition at line 164 of file class.ilLSLaunchlinksBuilder.php.

References getLinks().

164  : array
165  {
166  $buttons = [];
167  foreach ($this->getLinks() as $idx => $entry) {
168  list($label, $link) = $entry;
169  $buttons[] = $this->ui_factory->button()->standard($label, $link);
170  }
171  return $buttons;
172  }
+ Here is the call graph for this function:

◆ getLink()

ilLSLaunchlinksBuilder::getLink ( string  $cmd)
protected

Definition at line 97 of file class.ilLSLaunchlinksBuilder.php.

References ILIAS\Repository\ctrl().

Referenced by getLinks().

97  : string
98  {
99  return $this->ctrl->getLinkTargetByClass('ilObjLearningSequenceLearnerGUI', $cmd);
100  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinks()

ilLSLaunchlinksBuilder::getLinks ( )

Definition at line 102 of file class.ilLSLaunchlinksBuilder.php.

References ILIAS\Repository\ctrl(), getLink(), hasCompleted(), isMember(), ILIAS\Repository\lng(), mayJoin(), and mayUnparticipate().

Referenced by getLaunchbuttonsComponent().

102  : array
103  {
104  $cmd = $this->ctrl->getCmd();
105  $links = [];
106 
107  if (!$this->isMember() && $this->mayJoin()) {
108  if (!$this->ls_items->hasItems()) {
109  return [];
110  }
111  return [[
112  $this->lng->txt("lso_player_start"),
113  $this->getLink(self::CMD_START),
114  true
115  ]];
116  }
117 
118  if (!$this->hasCompleted() && $this->ls_items->hasItems()) {
119  $label = "lso_player_resume";
120  if ($this->first_access === -1) {
121  $label = "lso_player_start";
122  }
123  $links[] = [
124  $this->lng->txt($label),
125  $this->getLink(self::CMD_VIEW),
126  true
127  ];
128  } else {
129  if ($this->ls_items->hasItems()) {
130  $links[] = [
131  $this->lng->txt("lso_player_review"),
132  $this->getLink(self::CMD_VIEW),
133  true
134  ];
135  }
136 
137  if ($cmd === self::CMD_STANDARD) {
138  $links[] = [
139  $this->lng->txt("lso_player_extro"),
140  $this->getLink(self::CMD_EXTRO),
141  false
142  ];
143  }
144  if ($cmd === self::CMD_EXTRO) {
145  $links[] = [
146  $this->lng->txt("lso_player_abstract"),
147  $this->getLink(self::CMD_STANDARD),
148  false
149  ];
150  }
151  }
152 
153  if ($this->mayUnparticipate()) {
154  $links[] = [
155  $this->lng->txt("unparticipate"),
156  $this->getLink(self::CMD_UNSUBSCRIBE),
157  false
158  ];
159  }
160 
161  return $links;
162  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasCompleted()

ilLSLaunchlinksBuilder::hasCompleted ( )
protected

Definition at line 92 of file class.ilLSLaunchlinksBuilder.php.

Referenced by getLinks().

92  : bool
93  {
94  return $this->roles->isCompletedByUser($this->usr_id);
95  }
+ Here is the caller graph for this function:

◆ isMember()

ilLSLaunchlinksBuilder::isMember ( )
protected

Definition at line 87 of file class.ilLSLaunchlinksBuilder.php.

Referenced by getLinks().

87  : bool
88  {
89  return $this->roles->isMember($this->usr_id);
90  }
+ Here is the caller graph for this function:

◆ mayJoin()

ilLSLaunchlinksBuilder::mayJoin ( )
protected

Definition at line 71 of file class.ilLSLaunchlinksBuilder.php.

References ILIAS\Repository\access().

Referenced by getLinks().

71  : bool
72  {
73  return $this->access->checkAccess(self::PERM_PARTICIPATE, '', $this->lso_ref_id);
74  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mayUnparticipate()

ilLSLaunchlinksBuilder::mayUnparticipate ( )
protected

Definition at line 82 of file class.ilLSLaunchlinksBuilder.php.

References ILIAS\Repository\access().

Referenced by currentUserMayUnparticipate(), and getLinks().

82  : bool
83  {
84  return $this->access->checkAccess(self::PERM_UNPARTICIPATE, '', $this->lso_ref_id);
85  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccess ilLSLaunchlinksBuilder::$access
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilLSLaunchlinksBuilder::$ctrl
protected

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

Referenced by __construct().

◆ $first_access

ilLSLaunchlinksBuilder::$first_access
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilLSLaunchlinksBuilder::$lng
protected

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

◆ $ls_items

ilLSLearnerItemsQueries ilLSLaunchlinksBuilder::$ls_items
protected

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

Referenced by __construct().

◆ $lso_ref_id

int ilLSLaunchlinksBuilder::$lso_ref_id
protected

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

Referenced by __construct().

◆ $roles

ilLearningSequenceRoles ilLSLaunchlinksBuilder::$roles
protected

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

Referenced by __construct().

◆ $ui_factory

ILIAS UI Factory ilLSLaunchlinksBuilder::$ui_factory
protected

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

Referenced by __construct().

◆ $usr_id

int ilLSLaunchlinksBuilder::$usr_id
protected

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

Referenced by __construct().

◆ CMD_EXTRO

const ilLSLaunchlinksBuilder::CMD_EXTRO = ilObjLearningSequenceLearnerGUI::CMD_EXTRO

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

◆ CMD_STANDARD

const ilLSLaunchlinksBuilder::CMD_STANDARD = ilObjLearningSequenceLearnerGUI::CMD_STANDARD

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

◆ CMD_START

const ilLSLaunchlinksBuilder::CMD_START = ilObjLearningSequenceLearnerGUI::CMD_START

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

◆ CMD_UNSUBSCRIBE

const ilLSLaunchlinksBuilder::CMD_UNSUBSCRIBE = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE

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

◆ CMD_VIEW

const ilLSLaunchlinksBuilder::CMD_VIEW = ilObjLearningSequenceLearnerGUI::CMD_VIEW

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

◆ PERM_PARTICIPATE

const ilLSLaunchlinksBuilder::PERM_PARTICIPATE = 'participate'

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

◆ PERM_UNPARTICIPATE

const ilLSLaunchlinksBuilder::PERM_UNPARTICIPATE = 'unparticipate'

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


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