ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLearningSequenceMembershipGUI Class Reference

GUI class for learning sequence membership features. More...

+ Inheritance diagram for ilLearningSequenceMembershipGUI:
+ Collaboration diagram for ilLearningSequenceMembershipGUI:

Public Member Functions

 __construct (ilObjectGUI $repository_gui, protected ilObject $obj, protected ilObjUserTracking $obj_user_tracking, protected ilPrivacySettings $privacy_settings, protected ilRbacReview $rbac_review, protected ilSetting $settings, protected ilToolbarGUI $toolbar, protected ILIAS\HTTP\Wrapper\RequestWrapper $request_wrapper, protected ArrayBasedRequestWrapper $post_wrapper, protected ILIAS\Refinery\Factory $refinery, protected ILIAS\UI\Factory $ui_factory)
 
 filterUserIdsByRbacOrPositionOfCurrentUser (array $a_user_ids)
 Filter user ids by access. More...
 
 assignMembers (array $user_ids, string $type)
 
 getParentObject ()
 
 getLocalTypeRole (bool $translation=false)
 
 readMemberData (array $usr_ids, ?array $columns=null)
 
 getPrintMemberData (array $members)
 
 getAttendanceListUserData (int $user_id, array $filters=[])
 
- Public Member Functions inherited from ilMembershipGUI
 __construct (ilObjectGUI $repository_gui, ilObject $repository_obj)
 
 getParentGUI ()
 
 getParentObject ()
 
 getMembersObject ()
 
 filterUserIdsByRbacOrPositionOfCurrentUser (array $a_user_ids)
 Filter user ids by access. More...
 
 executeCommand ()
 
 getAttendanceListUserData (int $user_id, array $filters=[])
 
 updateParticipants ()
 update members More...
 
 createMailSignature ()
 Create Mail signature. More...
 
 addMemberTab (ilTabsGUI $tabs, bool $a_is_participant=false)
 
 readMemberData (array $usr_ids, array $columns)
 Required for member table guis. More...
 
 getLocalRoles ()
 
 confirmAssignSubscribers ()
 Show subscription confirmation. More...
 
 confirmRefuseSubscribers ()
 Refuse subscriber confirmation. More...
 
 assignSubscribers ()
 Do assignment of subscription request. More...
 
 confirmAssignFromWaitingList ()
 Assign from waiting list (confirmatoin) More...
 
 assignFromWaitingList ()
 Assign from waiting list. More...
 
 confirmRefuseFromList ()
 Refuse from waiting list (confirmation) More...
 

Protected Member Functions

 members ()
 
 printMembers ()
 
 getDefaultCommand ()
 
 updateParticipantsStatus ()
 save in participants table More...
 
 initParticipantTableGUI ()
 
 initEditParticipantTableGUI (array $participants)
 
 initParticipantTemplate ()
 Init participant view template. More...
 
 initWaitingList ()
 
 getDefaultRole ()
 
 getMailMemberRoles ()
 
 setSubTabs (ilTabsGUI $tabs)
 
 showParticipantsToolbar ()
 
- Protected Member Functions inherited from ilMembershipGUI
 initParticipantsFromPost ()
 
 initMemberIdFromGet ()
 
 initSubscribersFromPost ()
 
 initWaitingListIdsFromPost ()
 
 getLanguage ()
 
 getCtrl ()
 
 getLogger ()
 
 getMailMemberRoles ()
 
 checkPermissionBool (string $a_permission, string $a_cmd='', string $a_type='', int $a_ref_id=0)
 
 checkRbacOrPositionAccessBool (string $a_rbac_perm, string $a_pos_perm, int $a_ref_id=0)
 
 checkPermission (string $a_permission, string $a_cmd="")
 Check permission If not granted redirect to parent gui. More...
 
 checkRbacOrPermissionAccess (string $a_rbac_perm, string $a_pos_perm)
 check rbac or position access More...
 
 canAddOrSearchUsers ()
 Check if current user is allowed to add / search users. More...
 
 participants ()
 Show participant table, subscriber table, wating list table;. More...
 
 getParticipantTableTitle ()
 
 participantsApplyFilter ()
 Apply filter for participant table. More...
 
 participantsResetFilter ()
 reset participants filter More...
 
 editMember ()
 Edit one participant. More...
 
 editParticipants (array $post_participants=array())
 Edit participants. More...
 
 updateLPFromStatus (int $usr_id, bool $has_passed)
 
 confirmDeleteParticipants ()
 Show confirmation screen for participants deletion. More...
 
 deleteParticipants ()
 
 sendMailToSelectedUsers ()
 
 getMailContextOptions ()
 
 membersMap ()
 Members map. More...
 
 mailMembersBtn ()
 
 showParticipantsToolbar ()
 Show participants toolbar. More...
 
 showMemberExportToolbarButton (ilToolbarGUI $toolbar, ?string $a_back_cmd=null, bool $a_separator=false)
 
 showMailToMemberToolbarButton (ilToolbarGUI $toolbar, ?string $a_back_cmd=null, bool $a_separator=false)
 Show mail to member toolbar button. More...
 
 getDefaultCommand ()
 
 getMemberTabName ()
 
 setSubTabs (ilTabsGUI $tabs)
 Set sub tabs. More...
 
 parseSubscriberTable ()
 Parse table of subscription request. More...
 
 initSubscriberTable ()
 
 refuseSubscribers ()
 
 parseWaitingListTable ()
 Parse table of subscription request. More...
 
 refuseFromList ()
 refuse from waiting list More...
 
 addToClipboard ()
 Add selected users to user clipboard. More...
 
 getDefaultRole ()
 
 activateSubTab (string $a_sub_tab)
 
 printMembers ()
 
 printMembersOutput ()
 print members output More...
 
 printForMembersOutput ()
 print members output More...
 
 jump2UsersGallery ()
 
 initAttendanceList (bool $a_for_members=false)
 

Additional Inherited Members

- Protected Attributes inherited from ilMembershipGUI
GlobalHttpState $http
 
Factory $refinery
 
ilLanguage $lng
 
ilCtrlInterface $ctrl
 
ilLogger $logger
 
ilGlobalTemplateInterface $tpl
 
ilAccessHandler $access
 
ilParticipants $participants = null
 
ilObjUser $user
 
ilErrorHandling $error
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ilRbacSystem $rbacsystem
 
ilRbacReview $rbacreview
 
ilTree $tree
 
array $member_data = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceMembershipGUI::__construct ( ilObjectGUI  $repository_gui,
protected ilObject  $obj,
protected ilObjUserTracking  $obj_user_tracking,
protected ilPrivacySettings  $privacy_settings,
protected ilRbacReview  $rbac_review,
protected ilSetting  $settings,
protected ilToolbarGUI  $toolbar,
protected ILIAS\HTTP\Wrapper\RequestWrapper  $request_wrapper,
protected ArrayBasedRequestWrapper  $post_wrapper,
protected ILIAS\Refinery\Factory  $refinery,
protected ILIAS\UI\Factory  $ui_factory 
)

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

References ILIAS\GlobalScreen\Provider\__construct().

46  {
47  parent::__construct($repository_gui, $obj);
48  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ assignMembers()

ilLearningSequenceMembershipGUI::assignMembers ( array  $user_ids,
string  $type 
)
Parameters
array<int>$user_ids

Definition at line 111 of file class.ilLearningSequenceMembershipGUI.php.

References ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), getParentObject(), ilParticipants\IL_LSO_ADMIN, ilParticipants\IL_LSO_MEMBER, ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilLearningSequenceMembershipMailNotification\TYPE_ADMISSION_MEMBER.

111  : bool
112  {
113  $object = $this->getParentObject();
114  $members = $this->getParentObject()->getLSParticipants();
115 
116  if (count($user_ids) == 0) {
117  $this->lng->loadLanguageModule('search');
118  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_err_user_not_exist'), true);
119  return false;
120  }
121 
122  $assigned = false;
123  foreach ($user_ids as $new_member) {
124  $new_member = (int) $new_member;
125 
126  if ($members->isAssigned($new_member)) {
127  continue;
128  }
129 
130  switch ($type) {
131  case $object->getDefaultAdminRole():
132  $members->add($new_member, ilParticipants::IL_LSO_ADMIN);
133  $members->sendNotification(
135  $new_member
136  );
137  $assigned = true;
138  break;
139  case $object->getDefaultMemberRole():
140  $members->add($new_member, ilParticipants::IL_LSO_MEMBER);
141  $members->sendNotification(
143  $new_member
144  );
145  $assigned = true;
146  break;
147  default:
148  if (in_array($type, $object->getLocalLearningSequenceRoles(true))) {
149  $members->add($new_member, ilParticipants::IL_LSO_MEMBER);
150  $members->updateRoleAssignments($new_member, array($type));
151  } else {
152  ilLoggerFactory::getLogger('lso')->notice(
153  'Can not find role with id .' . $type . ' to assign users.'
154  );
155  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("lso_cannot_find_role"), true);
156  return false;
157  }
158 
159  $members->sendNotification(
161  $new_member
162  );
163  $assigned = true;
164  break;
165  }
166  }
167 
168  if ($assigned) {
169  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lso_msg_member_assigned"), true);
170  } else {
171  $this->tpl->setOnScreenMessage('success', $this->lng->txt('lso_users_already_assigned'), true);
172  }
173 
174  $this->ctrl->redirect($this, 'participants');
175  return $assigned;
176  }
static getLogger(string $a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ filterUserIdsByRbacOrPositionOfCurrentUser()

ilLearningSequenceMembershipGUI::filterUserIdsByRbacOrPositionOfCurrentUser ( array  $a_user_ids)

Filter user ids by access.

Parameters
int[]$a_user_ids
Returns
int[]

Definition at line 98 of file class.ilLearningSequenceMembershipGUI.php.

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

Referenced by getAttendanceListUserData().

98  : array
99  {
100  return $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
101  'manage_members',
102  'manage_members',
103  $this->getParentObject()->getRefId(),
104  $a_user_ids
105  );
106  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAttendanceListUserData()

ilLearningSequenceMembershipGUI::getAttendanceListUserData ( int  $user_id,
array  $filters = [] 
)
Returns
array<string, mixed>

Definition at line 304 of file class.ilLearningSequenceMembershipGUI.php.

References $data, $user_id, filterUserIdsByRbacOrPositionOfCurrentUser(), and ILIAS\Repository\lng().

304  : array
305  {
306  $data = array();
307 
309  $data = $this->member_data[$user_id];
310  if (array_key_exists('access_time', $data)) {
311  $data['access'] = $data['access_time'];
312  }
313  $data['progress'] = $this->lng->txt($data['progress']);
314  }
315 
316  return $data;
317  }
filterUserIdsByRbacOrPositionOfCurrentUser(array $a_user_ids)
Filter user ids by access.
+ Here is the call graph for this function:

◆ getDefaultCommand()

ilLearningSequenceMembershipGUI::getDefaultCommand ( )
protected

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

References $r, and ilMembershipGUI\$refinery.

87  : string
88  {
90  return $this->request_wrapper->retrieve("back_cmd", $r->byTrying([$r->kindlyTo()->string(), $r->always("members")]));
91  }
$r

◆ getDefaultRole()

ilLearningSequenceMembershipGUI::getDefaultRole ( )
protected

Definition at line 286 of file class.ilLearningSequenceMembershipGUI.php.

References getParentObject().

Referenced by showParticipantsToolbar().

286  : ?int
287  {
288  return $this->getParentObject()->getDefaultMemberRole();
289  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalTypeRole()

ilLearningSequenceMembershipGUI::getLocalTypeRole ( bool  $translation = false)
Returns
array<string, int>

Definition at line 265 of file class.ilLearningSequenceMembershipGUI.php.

References getParentObject().

265  : array
266  {
267  return $this->getParentObject()->getLocalLearningSequenceRoles($translation);
268  }
+ Here is the call graph for this function:

◆ getMailMemberRoles()

ilLearningSequenceMembershipGUI::getMailMemberRoles ( )
protected

◆ getParentObject()

ilLearningSequenceMembershipGUI::getParentObject ( )

Definition at line 230 of file class.ilLearningSequenceMembershipGUI.php.

Referenced by assignMembers(), filterUserIdsByRbacOrPositionOfCurrentUser(), getDefaultRole(), getLocalTypeRole(), initEditParticipantTableGUI(), initParticipantTableGUI(), initWaitingList(), members(), readMemberData(), setSubTabs(), and updateParticipantsStatus().

231  {
232  $obj = parent::getParentObject();
233  if (!$obj instanceof ilObjLearningSequence) {
234  throw new Exception('Invalid class type ' . get_class($obj) . ". Expected ilObjLearningSequence.");
235  }
236  return $obj;
237  }
+ Here is the caller graph for this function:

◆ getPrintMemberData()

ilLearningSequenceMembershipGUI::getPrintMemberData ( array  $members)
Returns
array<string, mixed>

Definition at line 294 of file class.ilLearningSequenceMembershipGUI.php.

References ilMembershipGUI\$member_data, ilMembershipGUI\getParentGUI(), and readMemberData().

294  : array
295  {
296  $member_data = $this->readMemberData($members, array());
297 
298  return $this->getParentGUI()->addCustomData($member_data);
299  }
readMemberData(array $usr_ids, ?array $columns=null)
+ Here is the call graph for this function:

◆ initEditParticipantTableGUI()

ilLearningSequenceMembershipGUI::initEditParticipantTableGUI ( array  $participants)
protected

Definition at line 239 of file class.ilLearningSequenceMembershipGUI.php.

References getParentObject(), ILIAS\Repository\lng(), and readMemberData().

240  {
242  $this,
243  $this->getParentObject(),
244  $this->getParentObject()->getLSParticipants(),
245  $this->privacy_settings
246  );
247 
248  $table->setTitle($this->lng->txt($this->getParentObject()->getType() . '_header_edit_members'));
249  $table->setData($this->readMemberData($participants));
250 
251  return $table;
252  }
ilParticipants $participants
readMemberData(array $usr_ids, ?array $columns=null)
+ Here is the call graph for this function:

◆ initParticipantTableGUI()

ilLearningSequenceMembershipGUI::initParticipantTableGUI ( )
protected

Definition at line 216 of file class.ilLearningSequenceMembershipGUI.php.

References ILIAS\Repository\access(), getParentObject(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

217  {
219  $this,
220  $this->getParentObject(),
221  $this->obj_user_tracking,
222  $this->privacy_settings,
223  $this->lng,
224  $this->access,
225  $this->rbac_review,
226  $this->settings
227  );
228  }
+ Here is the call graph for this function:

◆ initParticipantTemplate()

ilLearningSequenceMembershipGUI::initParticipantTemplate ( )
protected

Init participant view template.

Definition at line 257 of file class.ilLearningSequenceMembershipGUI.php.

257  : void
258  {
259  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lso_edit_members.html', 'components/ILIAS/LearningSequence');
260  }

◆ initWaitingList()

ilLearningSequenceMembershipGUI::initWaitingList ( )
protected

◆ members()

ilLearningSequenceMembershipGUI::members ( )
protected

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

References ilMembershipGUI\checkRbacOrPositionAccessBool(), getParentObject(), ilMembershipGUI\jump2UsersGallery(), and ilMembershipGUI\participants().

50  : void
51  {
52  $may_manage_members = $this->checkRbacOrPositionAccessBool(
53  'manage_members',
54  'manage_members',
55  $this->getParentObject()->getRefId()
56  );
57 
58  if ($may_manage_members) {
59  $this->participants();
60  } else {
61  $this->jump2UsersGallery();
62  }
63  }
participants()
Show participant table, subscriber table, wating list table;.
checkRbacOrPositionAccessBool(string $a_rbac_perm, string $a_pos_perm, int $a_ref_id=0)
+ Here is the call graph for this function:

◆ printMembers()

ilLearningSequenceMembershipGUI::printMembers ( )
protected

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

References $DIC, ilMembershipGUI\checkPermission(), ilMembershipGUI\checkRbacOrPositionAccessBool(), ILIAS\Repository\ctrl(), ilMembershipGUI\initAttendanceList(), and ILIAS\Repository\lng().

65  : void
66  {
67  $this->checkPermission('read');
68  if ($this->checkRbacOrPositionAccessBool('manage_members', 'manage_members')) {
69  $back_cmd = 'participants';
70  } else {
71  $back_cmd = 'jump2UsersGallery';
72  }
73 
74  global $DIC;
75  $ilTabs = $DIC['ilTabs'];
76  $ilTabs->clearTargets();
77  $ilTabs->setBackTarget(
78  $this->lng->txt('back'),
79  $this->ctrl->getLinkTarget($this, $back_cmd)
80  );
81 
82  $list = $this->initAttendanceList();
83  $form = $list->initForm('printMembersOutput');
84  $this->tpl->setContent($form->getHTML());
85  }
checkPermission(string $a_permission, string $a_cmd="")
Check permission If not granted redirect to parent gui.
initAttendanceList(bool $a_for_members=false)
global $DIC
Definition: shib_login.php:22
checkRbacOrPositionAccessBool(string $a_rbac_perm, string $a_pos_perm, int $a_ref_id=0)
+ Here is the call graph for this function:

◆ readMemberData()

ilLearningSequenceMembershipGUI::readMemberData ( array  $usr_ids,
?array  $columns = null 
)
Parameters
array<int|string>$user_ids
string[]$columns
Returns
array<int|string, array>

Definition at line 275 of file class.ilLearningSequenceMembershipGUI.php.

References getParentObject().

Referenced by getPrintMemberData(), and initEditParticipantTableGUI().

275  : array
276  {
277  return $this->getParentObject()->readMemberData($usr_ids, $columns);
278  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilLearningSequenceMembershipGUI::setSubTabs ( ilTabsGUI  $tabs)
protected

Definition at line 324 of file class.ilLearningSequenceMembershipGUI.php.

References ilMembershipGUI\$access, ilTabsGUI\addSubTabTarget(), ilMembershipGUI\checkRbacOrPositionAccessBool(), ILIAS\Repository\ctrl(), and getParentObject().

324  : void
325  {
327  'manage_members',
328  'manage_members',
329  $this->getParentObject()->getRefId()
330  );
331 
332  if ($access) {
333  $tabs->addSubTabTarget(
334  $this->getParentObject()->getType() . "_member_administration",
335  $this->ctrl->getLinkTarget($this, 'participants'),
336  "members",
337  get_class($this)
338  );
339 
340  $tabs->addSubTabTarget(
341  $this->getParentObject()->getType() . '_members_gallery',
342  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
343  'view',
344  'ilUsersGalleryGUI'
345  );
346  } elseif ($this->getParentObject()->getShowMembers()) {
347  $tabs->addSubTabTarget(
348  $this->getParentObject()->getType() . '_members_gallery',
349  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
350  'view',
351  'ilUsersGalleryGUI'
352  );
353  }
354  }
addSubTabTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
ilAccessHandler $access
checkRbacOrPositionAccessBool(string $a_rbac_perm, string $a_pos_perm, int $a_ref_id=0)
+ Here is the call graph for this function:

◆ showParticipantsToolbar()

ilLearningSequenceMembershipGUI::showParticipantsToolbar ( )
protected

Definition at line 356 of file class.ilLearningSequenceMembershipGUI.php.

References ILIAS\Repository\ctrl(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), getDefaultRole(), ilMembershipGUI\getParentGUI(), ILIAS\Repository\lng(), ilMembershipGUI\showMailToMemberToolbarButton(), and ILIAS\Repository\toolbar().

356  : void
357  {
358  $toolbar_entries = [
359  'auto_complete_name' => $this->lng->txt('user'),
360  'user_type' => $this->getParentGUI()->getLocalRoles(),
361  'user_type_default' => $this->getDefaultRole(),
362  'submit_name' => $this->lng->txt('add'),
363  'add_search' => true
364  ];
365 
366  $search_params = ['crs', 'grp'];
367  $parent_container = $this->obj->getParentObjectInfo(
368  $this->obj->getRefId(),
369  $search_params
370  );
371  if (!is_null($parent_container)) {
372  $container_id = $parent_container['ref_id'];
373  $toolbar_entries['add_from_container'] = $container_id;
374  }
375 
377  $this,
378  $this->toolbar,
379  $toolbar_entries
380  );
381 
382  $this->toolbar->addSeparator();
383 
384  $this->toolbar->addComponent(
385  $this->ui_factory->button()->standard(
386  $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
387  $this->ctrl->getLinkTarget($this, 'printMembers')
388  )
389  );
390 
391  $this->showMailToMemberToolbarButton($this->toolbar, 'participants');
392  }
showMailToMemberToolbarButton(ilToolbarGUI $toolbar, ?string $a_back_cmd=null, bool $a_separator=false)
Show mail to member toolbar button.
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt(&#39;user&#39;), auto_complete_size = 15, user_type = array(ilCoursePar...
+ Here is the call graph for this function:

◆ updateParticipantsStatus()

ilLearningSequenceMembershipGUI::updateParticipantsStatus ( )
protected

save in participants table

Definition at line 181 of file class.ilLearningSequenceMembershipGUI.php.

References ilMembershipGUI\$participants, ILIAS\Repository\ctrl(), getParentObject(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilParticipants\updateNotification().

181  : void
182  {
183  $members = $this->getParentObject()->getLSParticipants();
184 
185  $participants = $this->post_wrapper->retrieve(
186  "visible_member_ids",
187  $this->refinery->byTrying([
188  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
189  $this->refinery->always([])
190  ])
191  );
192 
193 
194 
195 
196  $notification = [];
197  if ($this->post_wrapper->has('notification')) {
198  $notification = $this->post_wrapper->retrieve(
199  "notification",
200  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
201  );
202  }
203 
204  foreach ($participants as $participant) {
205  if ($members->isAdmin($participant)) {
206  $members->updateNotification($participant, in_array($participant, $notification));
207  continue;
208  }
209  $members->updateNotification($participant, false);
210  }
211 
212  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
213  $this->ctrl->redirect($this, 'participants');
214  }
updateNotification(int $a_usr_id, bool $a_notification)
Update notification status.
ilParticipants $participants
+ Here is the call graph for this function:

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