ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 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)
 

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

47 {
48 }

Member Function Documentation

◆ currentUserMayUnparticipate()

ilLSLaunchlinksBuilder::currentUserMayUnparticipate ( )

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

55 : bool
56 {
57 return $this->mayUnparticipate();
58 }

References mayUnparticipate().

+ Here is the call graph for this function:

◆ getLaunchbuttonsComponent()

ilLSLaunchlinksBuilder::getLaunchbuttonsComponent ( )

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

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

References getLinks().

+ Here is the call graph for this function:

◆ getLink()

ilLSLaunchlinksBuilder::getLink ( string  $cmd)
protected

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

75 : string
76 {
77 return $this->ctrl->getLinkTargetByClass('ilObjLearningSequenceLearnerGUI', $cmd);
78 }

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

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

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

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

70 : bool
71 {
72 return $this->roles->isCompletedByUser($this->usr_id);
73 }

Referenced by getLinks().

+ Here is the caller graph for this function:

◆ isMember()

ilLSLaunchlinksBuilder::isMember ( )
protected

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

65 : bool
66 {
67 return $this->roles->isMember($this->usr_id);
68 }

Referenced by getLinks().

+ Here is the caller graph for this function:

◆ mayJoin()

ilLSLaunchlinksBuilder::mayJoin ( )
protected

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

50 : bool
51 {
52 return $this->access->checkAccess(self::PERM_PARTICIPATE, '', $this->lso_ref_id);
53 }

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

60 : bool
61 {
62 return $this->access->checkAccess(self::PERM_UNPARTICIPATE, '', $this->lso_ref_id);
63 }

References ILIAS\Repository\access().

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

◆ CMD_STANDARD

const ilLSLaunchlinksBuilder::CMD_STANDARD = ilObjLearningSequenceLearnerGUI::CMD_STANDARD

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

◆ CMD_START

const ilLSLaunchlinksBuilder::CMD_START = ilObjLearningSequenceLearnerGUI::CMD_START

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

◆ CMD_UNSUBSCRIBE

const ilLSLaunchlinksBuilder::CMD_UNSUBSCRIBE = ilObjLearningSequenceLearnerGUI::CMD_UNSUBSCRIBE

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

◆ CMD_VIEW

const ilLSLaunchlinksBuilder::CMD_VIEW = ilObjLearningSequenceLearnerGUI::CMD_VIEW

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

◆ PERM_PARTICIPATE

const ilLSLaunchlinksBuilder::PERM_PARTICIPATE = 'participate'

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

◆ PERM_UNPARTICIPATE

const ilLSLaunchlinksBuilder::PERM_UNPARTICIPATE = 'unparticipate'

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


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