ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilLSLaunchlinksBuilder Class Reference

Builds the links to join/(re-)start the LearningSequence. More...

+ Collaboration diagram for ilLSLaunchlinksBuilder:

Public Member Functions

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

Data Fields

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_CONFIRMATION = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE_CONFIRMATION
 

Protected Member Functions

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

Detailed Description

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 26 of file class.ilLSLaunchlinksBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

44 {
45 }

Member Function Documentation

◆ currentUserMayUnparticipate()

ilLSLaunchlinksBuilder::currentUserMayUnparticipate ( )

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

52 : bool
53 {
54 return $this->mayUnparticipate();
55 }

References mayUnparticipate().

+ Here is the call graph for this function:

◆ getLaunchbuttonsComponent()

ilLSLaunchlinksBuilder::getLaunchbuttonsComponent ( )

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

139 : array
140 {
141 $buttons = [];
142 foreach ($this->getLinks() as $idx => $entry) {
143 list($label, $link, $primary) = $entry;
144 if ($primary) {
145 $buttons[] = $this->ui_factory->button()->primary($label, $link);
146 } else {
147 $buttons[] = $this->ui_factory->button()->standard($label, $link);
148 }
149 }
150 return $buttons;
151 }

References getLinks().

+ Here is the call graph for this function:

◆ getLink()

ilLSLaunchlinksBuilder::getLink ( string  $cmd)
protected

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

72 : string
73 {
74 return $this->ctrl->getLinkTargetByClass('ilObjLearningSequenceLearnerGUI', $cmd);
75 }

References ILIAS\Repository\ctrl().

Referenced by getLinks().

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

◆ getLinks()

ilLSLaunchlinksBuilder::getLinks ( )

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

77 : array
78 {
79 $cmd = $this->ctrl->getCmd();
80 $links = [];
81
82 if (!$this->isMember() && $this->mayJoin()) {
83 if (!$this->ls_items->hasItems()) {
84 return [];
85 }
86 return [[
87 $this->lng->txt("lso_player_start"),
88 $this->getLink(self::CMD_START),
89 true
90 ]];
91 }
92
93 if (!$this->hasCompleted() && $this->ls_items->hasItems()) {
94 $label = "lso_player_resume";
95 if ($this->first_access === -1) {
96 $label = "lso_player_start";
97 }
98 $links[] = [
99 $this->lng->txt($label),
100 $this->getLink(self::CMD_VIEW),
101 true
102 ];
103 } else {
104 if ($this->ls_items->hasItems()) {
105 $links[] = [
106 $this->lng->txt("lso_player_review"),
107 $this->getLink(self::CMD_VIEW),
108 true
109 ];
110 }
111
112 if ($cmd === self::CMD_STANDARD) {
113 $links[] = [
114 $this->lng->txt("lso_player_extro"),
115 $this->getLink(self::CMD_EXTRO),
116 false
117 ];
118 }
119 if ($cmd === self::CMD_EXTRO) {
120 $links[] = [
121 $this->lng->txt("lso_player_abstract"),
122 $this->getLink(self::CMD_STANDARD),
123 false
124 ];
125 }
126 }
127
128 if ($this->mayUnparticipate()) {
129 $links[] = [
130 $this->lng->txt("unparticipate"),
131 $this->getLink(self::CMD_UNSUBSCRIBE_CONFIRMATION),
132 false
133 ];
134 }
135
136 return $links;
137 }

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

Referenced by getLaunchbuttonsComponent().

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

◆ hasCompleted()

ilLSLaunchlinksBuilder::hasCompleted ( )
protected

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

67 : bool
68 {
69 return $this->roles->isCompletedByUser($this->usr_id);
70 }

Referenced by getLinks().

+ Here is the caller graph for this function:

◆ isMember()

ilLSLaunchlinksBuilder::isMember ( )
protected

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

62 : bool
63 {
64 return $this->roles->isMember($this->usr_id);
65 }

Referenced by getLinks(), and mayUnparticipate().

+ Here is the caller graph for this function:

◆ mayJoin()

ilLSLaunchlinksBuilder::mayJoin ( )
protected

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

47 : bool
48 {
49 return $this->access->checkAccess('read', '', $this->lso_ref_id);
50 }

References ILIAS\Repository\access().

Referenced by getLinks().

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

◆ mayUnparticipate()

ilLSLaunchlinksBuilder::mayUnparticipate ( )
protected

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

57 : bool
58 {
59 return $this->isMember() && $this->access->checkAccess('read', '', $this->lso_ref_id);
60 }

References ILIAS\Repository\access(), and isMember().

Referenced by currentUserMayUnparticipate(), and getLinks().

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

Field Documentation

◆ CMD_EXTRO

const ilLSLaunchlinksBuilder::CMD_EXTRO = ilObjLearningSequenceLearnerGUI::CMD_EXTRO

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

◆ CMD_STANDARD

const ilLSLaunchlinksBuilder::CMD_STANDARD = ilObjLearningSequenceLearnerGUI::CMD_STANDARD

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

◆ CMD_START

const ilLSLaunchlinksBuilder::CMD_START = ilObjLearningSequenceLearnerGUI::CMD_START

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

◆ CMD_UNSUBSCRIBE_CONFIRMATION

const ilLSLaunchlinksBuilder::CMD_UNSUBSCRIBE_CONFIRMATION = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE_CONFIRMATION

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

◆ CMD_VIEW

const ilLSLaunchlinksBuilder::CMD_VIEW = ilObjLearningSequenceLearnerGUI::CMD_VIEW

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


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