ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMembershipGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
16  private $repository_object = null;
17 
21  private $repository_gui = null;
22 
26  protected $lng = null;
27 
31  protected $ctrl = null;
32 
36  protected $logger = null;
37 
41  protected $tpl;
42 
46  protected $access;
47 
48 
53  public function __construct(ilObjectGUI $repository_gui, ilObject $repository_obj)
54  {
55  global $DIC;
56 
57  $this->repository_gui = $repository_gui;
58  $this->repository_object = $repository_obj;
59 
60  $this->lng = $GLOBALS['DIC']->language();
61  $this->lng->loadLanguageModule('crs');
62  $this->lng->loadLanguageModule($this->getParentObject()->getType());
63  $this->lng->loadLanguageModule('trac');
64  $this->tpl = $GLOBALS['DIC']->ui()->mainTemplate();
65  $this->ctrl = $GLOBALS['DIC']->ctrl();
66  $this->logger = $DIC->logger()->mmbr();
67  $this->access = $GLOBALS['DIC']->access();
68  }
69 
73  protected function getLanguage()
74  {
75  return $this->lng;
76  }
77 
81  protected function getCtrl()
82  {
83  return $this->ctrl;
84  }
85 
89  protected function getLogger()
90  {
91  return $this->logger;
92  }
93 
94 
99  public function getParentGUI()
100  {
101  return $this->repository_gui;
102  }
103 
108  public function getParentObject()
109  {
111  }
112 
117  public function getMembersObject()
118  {
119  if ($this->participants instanceof ilParticipants) {
120  return $this->participants;
121  }
122  return $this->participants = ilParticipants::getInstance($this->getParentObject()->getRefId());
123  }
124 
128  protected function getMailMemberRoles()
129  {
130  return null;
131  }
132 
140  protected function checkPermissionBool($a_permission, $a_cmd = '', $a_type = '', $a_ref_id = 0)
141  {
142  if (!$a_ref_id) {
143  $a_ref_id = $this->getParentObject()->getRefId();
144  }
145  return $this->access->checkAccess($a_permission, $a_cmd, $a_ref_id);
146  }
147 
154  protected function checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id = 0)
155  {
156  if (!$a_ref_id) {
157  $a_ref_id = $this->getParentObject()->getRefId();
158  }
159  return $this->access->checkRbacOrPositionPermissionAccess($a_rbac_perm, $a_pos_perm, $a_ref_id);
160  }
161 
169  protected function checkPermission($a_permission, $a_cmd = "")
170  {
171  if (!$this->checkPermissionBool($a_permission, $a_cmd)) {
172  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
173  $this->ctrl->redirect($this->getParentGUI());
174  }
175  }
176 
183  protected function checkRbacOrPermissionAccess($a_rbac_perm, $a_pos_perm)
184  {
185  if (!$this->checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm)) {
186  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
187  $this->ctrl->redirect($this->getParentGUI());
188  }
189  }
190 
191 
192 
197  protected function canAddOrSearchUsers()
198  {
199  return $this->checkPermissionBool('manage_members');
200  }
201 
202 
208  public function filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
209  {
210  return $a_user_ids;
211  }
212 
216  public function executeCommand()
217  {
221  global $DIC;
222 
223  $ilUser = $DIC['ilUser'];
224  $ilErr = $DIC['ilErr'];
225  $ilAccess = $DIC['ilAccess'];
226  $rbacsystem = $DIC['rbacsystem'];
227  $ilTabs = $DIC['ilTabs'];
228 
229  $cmd = $this->ctrl->getCmd('participants');
230  $next_class = $this->ctrl->getNextClass();
231 
232  switch ($next_class) {
233  case 'ilrepositorysearchgui':
234 
235  $this->checkPermission('manage_members');
236 
237  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
238  include_once './Services/Membership/classes/class.ilParticipants.php';
239  $rep_search = new ilRepositorySearchGUI();
240  $rep_search->addUserAccessFilterCallable([$this,'filterUserIdsByRbacOrPositionOfCurrentUser']);
241 
242  $participants = $this->getMembersObject();
243  if (
244  $participants->isAdmin($GLOBALS['DIC']['ilUser']->getId()) ||
245  $ilAccess->checkAccess('manage_members', '', $this->getParentObject()->getRefId())
246  ) {
247  $rep_search->setCallback(
248  $this,
249  'assignMembers',
250  $this->getParentGUI()->getLocalRoles(),
251  (string) $this->getDefaultRole()
252  );
253  } else {
254  //#18445 excludes admin role
255  $rep_search->setCallback(
256  $this,
257  'assignMembers',
258  $this->getLocalRoles(array($this->getParentObject()->getDefaultAdminRole())),
259  (string) $this->getDefaultRole()
260  );
261  }
262 
263  // Set tabs
264  $this->ctrl->setReturn($this, 'participants');
265  $ret = $this->ctrl->forwardCommand($rep_search);
266  break;
267 
268 
269  case 'ilmailmembersearchgui':
270  $ilTabs->clearTargets();
271  $ilTabs->setBackTarget(
272  $this->lng->txt('btn_back'),
273  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
274  );
275 
276  $mail = new ilMail($ilUser->getId());
277  if (!(
278  $this->getParentObject()->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
279  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId())
280  ) ||
281  !$rbacsystem->checkAccess(
282  'internal_mail',
283  $mail->getMailObjectReferenceId()
284  )) {
285  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
286  }
287 
288  $mail_search = new ilMailMemberSearchGUI(
289  $this,
290  $this->getParentObject()->getRefId(),
291  $this->getMailMemberRoles()
292  );
293  $mail_search->setObjParticipants(
294  ilParticipants::getInstance($this->getParentObject()->getRefId())
295  );
296  $this->ctrl->forwardCommand($mail_search);
297  break;
298 
299  case 'ilusersgallerygui':
300 
301  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
302  $tabs = $GLOBALS['DIC']->tabs()->setSubTabActive(
303  $this->getParentObject()->getType() . '_members_gallery'
304  );
305 
306  $is_admin = (bool) $this->checkRbacOrPositionAccessBool('manage_members', 'manage_members');
307  $is_participant = (bool) ilParticipants::_isParticipant($this->getParentObject()->getRefId(), $ilUser->getId());
308  if (
309  !$is_admin &&
310  (
311  $this->getParentObject()->getShowMembers() == 0 ||
312  !$is_participant
313  )
314  ) {
315  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
316  }
317 
318  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar'], 'jump2UsersGallery');
319  $this->showMemberExportToolbarButton($GLOBALS['DIC']['ilToolbar'], 'jump2UsersGallery');
320 
321  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryGUI.php';
322  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryParticipants.php';
323 
324 
325  $provider = new ilUsersGalleryParticipants($this->getParentObject()->getMembersObject());
326  $gallery_gui = new ilUsersGalleryGUI($provider);
327  $this->ctrl->forwardCommand($gallery_gui);
328  break;
329 
330  case 'ilcourseparticipantsgroupsgui':
331 
332  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
333  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
334 
335 
336  include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
337  $cmg_gui = new ilCourseParticipantsGroupsGUI($this->getParentObject()->getRefId());
338  if ($cmd == "show" || $cmd = "") {
339  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar']);
340  }
341  $this->ctrl->forwardCommand($cmg_gui);
342  break;
343 
344  case 'ilsessionoverviewgui':
345 
346  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
347  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
348 
349  include_once './Services/Membership/classes/class.ilParticipants.php';
350  $prt = ilParticipants::getInstance($this->getParentObject()->getRefId());
351 
352  include_once('./Modules/Session/classes/class.ilSessionOverviewGUI.php');
353  $overview = new ilSessionOverviewGUI($this->getParentObject()->getRefId(), $prt);
354  $this->ctrl->forwardCommand($overview);
355  break;
356 
357  case 'ilmemberexportgui':
358 
359  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
360  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
361 
362  include_once('./Services/Membership/classes/Export/class.ilMemberExportGUI.php');
363  $export = new ilMemberExportGUI($this->getParentObject()->getRefId());
364  $this->ctrl->forwardCommand($export);
365  break;
366 
367  case 'ilobjectcustomuserfieldsgui':
368 
369  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
370  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
371  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
372  $this->ctrl->setReturn($this, 'participants');
373 
374  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
375  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->getParentGUI()->object->getId());
376  $this->ctrl->forwardCommand($cdf_gui);
377  break;
378 
379  default:
380 
381  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
382 
383  //exclude mailMembersBtn cmd from this check
384  if (
385  $cmd == "mailMembersBtn" ||
386  $cmd == 'membersMap' ||
387  $cmd == 'printForMembersOutput' ||
388  $cmd == 'jump2UsersGallery'
389  ) {
390  $this->checkPermission('read');
391  } else {
392  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
393  }
394 
395  $this->$cmd();
396  break;
397  }
398  }
399 
403  protected function participants()
404  {
405  $this->initParticipantTemplate();
406  $this->showParticipantsToolbar();
407  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
408 
409  // show waiting list table
410  $waiting = $this->parseWaitingListTable();
411  if ($waiting instanceof ilWaitingListTableGUI) {
412  $this->tpl->setVariable('TABLE_WAIT', $waiting->getHTML());
413  }
414 
415  // show subscriber table
416  $subscriber = $this->parseSubscriberTable();
417  if ($subscriber instanceof ilSubscriberTableGUI) {
418  $this->tpl->setVariable('TABLE_SUB', $subscriber->getHTML());
419  }
420 
421  // show member table
422  $table = $this->initParticipantTableGUI();
423  $table->setTitle($this->lng->txt($this->getParentObject()->getType() . '_mem_tbl_header'));
424  $table->setFormAction($this->ctrl->getFormAction($this));
425  $table->parse();
426 
427  // filter commands
428  $table->setFilterCommand('participantsApplyFilter');
429  $table->setResetCommand('participantsResetFilter');
430 
431  $this->tpl->setVariable('MEMBERS', $table->getHTML());
432  }
433 
437  protected function participantsApplyFilter()
438  {
439  $table = $this->initParticipantTableGUI();
440  $table->resetOffset();
441  $table->writeFilterToSession();
442 
443  $this->participants();
444  }
445 
449  protected function participantsResetFilter()
450  {
451  $table = $this->initParticipantTableGUI();
452  $table->resetOffset();
453  $table->resetFilter();
454 
455  $this->participants();
456  }
457 
458 
462  protected function editMember()
463  {
464  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
465  return $this->editParticipants(array($_REQUEST['member_id']));
466  }
467 
472  protected function editParticipants($post_participants = array())
473  {
474  if (!$post_participants) {
475  $post_participants = (array) $_POST['participants'];
476  }
477 
478  $real_participants = $this->getMembersObject()->getParticipants();
479  $participants = array_intersect((array) $post_participants, (array) $real_participants);
480 
481  if (!count($participants)) {
482  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
483  $this->ctrl->redirect($this, 'participants');
484  }
485  $table = $this->initEditParticipantTableGUI($participants);
486  $this->tpl->setContent($table->getHTML());
487  return true;
488  }
489 
497  public function updateParticipants()
498  {
499  global $DIC;
500 
501  $rbacsystem = $DIC['rbacsystem'];
502  $rbacreview = $DIC['rbacreview'];
503  $ilUser = $DIC['ilUser'];
504  $ilAccess = $DIC['ilAccess'];
505 
506  if (!array_key_exists('participants', $_POST) || !count($_POST['participants'])) {
507  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
508  $this->ctrl->redirect($this, 'participants');
509  }
510 
511  $notifications = $_POST['notification'] ? $_POST['notification'] : array();
512  $passed = $_POST['passed'] ? $_POST['passed'] : array();
513  $blocked = $_POST['blocked'] ? $_POST['blocked'] : array();
514  $contact = $_POST['contact'] ? $_POST['contact'] : array();
515 
516  // Determine whether the user has the 'edit_permission' permission
517  $hasEditPermissionAccess =
518  (
519  $ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) or
520  $this->getMembersObject()->isAdmin($ilUser->getId())
521  );
522 
523  // Get all assignable local roles of the object, and
524  // determine the role id of the course administrator role.
525  $assignableLocalRoles = array();
526  $adminRoleId = $this->getParentObject()->getDefaultAdminRole();
527  foreach ($this->getLocalTypeRole(false) as $title => $role_id) {
528  $assignableLocalRoles[$role_id] = $title;
529  }
530 
531  // Validate the user ids and role ids in the post data
532  foreach ($_POST['participants'] as $usr_id) {
533  $memberIsAdmin = $rbacreview->isAssigned($usr_id, $adminRoleId);
534 
535  // If the current user doesn't have the 'edit_permission'
536  // permission, make sure he doesn't remove the course
537  // administrator role of members who are course administrator.
538  if (!$hasEditPermissionAccess && $memberIsAdmin &&
539  !in_array($adminRoleId, $_POST['roles'][$usr_id])
540  ) {
541  $_POST['roles'][$usr_id][] = $adminRoleId;
542  }
543 
544  // Validate the role ids in the post data
545  foreach ((array) $_POST['roles'][$usr_id] as $role_id) {
546  if (!array_key_exists($role_id, $assignableLocalRoles)) {
547  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
548  $this->ctrl->redirect($this, 'participants');
549  }
550  if (!$hasEditPermissionAccess &&
551  $role_id == $adminRoleId &&
552  !$memberIsAdmin) {
553  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'));
554  $this->ctrl->redirect($this, 'participants');
555  }
556  }
557  }
558 
559  $has_admin = false;
560  foreach ($this->getMembersObject()->getAdmins() as $admin_id) {
561  if (!isset($_POST['roles'][$admin_id])) {
562  $has_admin = true;
563  break;
564  }
565  if (in_array($adminRoleId, $_POST['roles'][$admin_id])) {
566  $has_admin = true;
567  break;
568  }
569  }
570 
571  if (!$has_admin && is_array($_POST['roles'])) {
572  foreach ($_POST['roles'] as $usrId => $roleIdsToBeAssigned) {
573  if (in_array($adminRoleId, $roleIdsToBeAssigned)) {
574  $has_admin = true;
575  break;
576  }
577  }
578  }
579 
580  if (!$has_admin) {
581  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_min_one_admin'), true);
582  $this->ctrl->redirect($this, 'participants');
583  }
584 
585  foreach ($_POST['participants'] as $usr_id) {
586  $this->getMembersObject()->updateRoleAssignments($usr_id, (array) $_POST['roles'][$usr_id]);
587 
588  // Disable notification for all of them
589  $this->getMembersObject()->updateNotification($usr_id, 0);
590  if (($this->getMembersObject()->isTutor($usr_id) or $this->getMembersObject()->isAdmin($usr_id)) and in_array($usr_id, $notifications)) {
591  $this->getMembersObject()->updateNotification($usr_id, 1);
592  }
593 
594  $this->getMembersObject()->updateBlocked($usr_id, 0);
595  if ((!$this->getMembersObject()->isAdmin($usr_id) and !$this->getMembersObject()->isTutor($usr_id)) and in_array($usr_id, $blocked)) {
596  $this->getMembersObject()->updateBlocked($usr_id, 1);
597  }
598 
599  if ($this instanceof ilCourseMembershipGUI) {
600  $this->getMembersObject()->updatePassed($usr_id, in_array($usr_id, $passed), true);
601  $this->getMembersObject()->sendNotification(
602  $this->getMembersObject()->NOTIFY_STATUS_CHANGED,
603  $usr_id
604  );
605  }
606 
607  if (
608  ($this->getMembersObject()->isAdmin($usr_id) || $this->getMembersObject()->isTutor($usr_id)) &&
609  in_array($usr_id, $contact)
610  ) {
611  $this->getMembersObject()->updateContact($usr_id, true);
612  } else {
613  $this->getMembersObject()->updateContact($usr_id, false);
614  }
615 
616  $this->updateLPFromStatus($usr_id, in_array($usr_id, $passed));
617  }
618  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
619  $this->ctrl->redirect($this, "participants");
620  }
621 
625  protected function confirmDeleteParticipants()
626  {
627  global $DIC;
628 
629  $ilAccess = $DIC['ilAccess'];
630  $ilUser = $DIC['ilUser'];
631 
632  $participants = (array) $_POST['participants'];
633 
634  if (!count($participants)) {
635  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
636  $this->ctrl->redirect($this, 'participants');
637  }
638 
639  // Check last admin
640  if (!$this->getMembersObject()->checkLastAdmin($participants)) {
641  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_at_least_one_admin'), true);
642  $this->ctrl->redirect($this, 'participants');
643  }
644 
645  // if only position access is granted, show additional info
646  if (!$this->checkPermissionBool('manage_members')) {
647  $this->lng->loadLanguageModule('rbac');
648  ilUtil::sendInfo($this->lng->txt('rbac_info_only_position_access'));
649  }
650 
651 
652  // Access check for admin deletion
653  if (
654  !$ilAccess->checkAccess(
655  'edit_permission',
656  '',
657  $this->getParentObject()->getRefId()
658  ) &&
659  !$this->getMembersObject()->isAdmin($GLOBALS['DIC']['ilUser']->getId())
660  ) {
661  foreach ($participants as $usr_id) {
662  if ($this->getMembersObject()->isAdmin($usr_id)) {
663  ilUtil::sendFailure($this->lng->txt("msg_no_perm_perm"), true);
664  $this->ctrl->redirect($this, 'participants');
665  }
666  }
667  }
668 
670  $this->repository_object->getRefId(),
671  $participants
672  )) {
673  return $this->showDeleteParticipantsConfirmationWithLinkedCourses($participants);
674  }
675 
676  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
677  $confirm = new ilConfirmationGUI();
678  $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
679  $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
680  $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
681  $confirm->setCancel($this->lng->txt('cancel'), 'participants');
682 
683  foreach ($participants as $usr_id) {
684  $name = ilObjUser::_lookupName($usr_id);
685 
686  $confirm->addItem(
687  'participants[]',
688  $name['user_id'],
689  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
690  ilUtil::getImagePath('icon_usr.svg')
691  );
692  }
693 
694  $this->tpl->setContent($confirm->getHTML());
695  }
696 
697  protected function deleteParticipants()
698  {
699  global $DIC;
700 
701  $rbacreview = $DIC['rbacreview'];
702  $rbacsystem = $DIC['rbacsystem'];
703  $ilAccess = $DIC['ilAccess'];
704  $ilUser = $DIC['ilUser'];
705 
706  $participants = (array) $_POST['participants'];
707 
708  if (!is_array($participants) or !count($participants)) {
709  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
710  $this->ctrl->redirect($this, 'participants');
711  }
712 
713  // If the user doesn't have the edit_permission and is not administrator, he may not remove
714  // members who have the course administrator role
715  if (
716  !$ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) &&
717  !$this->getMembersObject()->isAdmin($GLOBALS['DIC']['ilUser']->getId())
718  ) {
719  foreach ($participants as $part) {
720  if ($this->getMembersObject()->isAdmin($part)) {
721  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
722  $this->ctrl->redirect($this, 'participants');
723  }
724  }
725  }
726 
727  if (!$this->getMembersObject()->deleteParticipants($participants)) {
728  ilUtil::sendFailure('Error deleting participants.', true);
729  $this->ctrl->redirect($this, 'participants');
730  } else {
731  foreach ((array) $_POST["participants"] as $usr_id) {
732  $mail_type = 0;
733  // @todo more generic
734  switch ($this->getParentObject()->getType()) {
735  case 'crs':
736  $mail_type = $this->getMembersObject()->NOTIFY_DISMISS_MEMBER;
737  break;
738  case 'grp':
739  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
741  break;
742  case 'lso':
744  break;
745  }
746  $this->getMembersObject()->sendNotification($mail_type, $usr_id);
747  }
748  }
749  ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
750  $this->ctrl->redirect($this, "participants");
751 
752  return true;
753  }
754 
758  protected function sendMailToSelectedUsers()
759  {
760  $participants = [];
761  if ($_POST['participants']) {
762  $participants = (array) $_POST['participants'];
763  } elseif ($_POST['subscribers']) {
764  $participants = (array) $_POST['subscribers'];
765  } elseif ($_POST['waiting']) {
766  $participants = (array) $_POST['waiting'];
767  } elseif ($_GET['member_id']) {
768  $participants = array($_GET['member_id']);
769  }
770 
771  if (!count($participants)) {
772  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
773  $this->ctrl->redirect($this, 'participants');
774  }
775 
776  foreach ($participants as $usr_id) {
777  $rcps[] = ilObjUser::_lookupLogin($usr_id);
778  }
779 
780 
781  $context_options = $this->getMailContextOptions();
782 
786  $this,
787  'participants',
788  array(),
789  array(
790  'type' => 'new',
791  'sig' => $this->createMailSignature()
792  ),
793  $context_options
794  )
795  );
796  }
797 
801  protected function getMailContextOptions() : array
802  {
803  return [];
804  }
805 
806 
810  protected function membersMap()
811  {
812  global $DIC;
813 
814  $tpl = $DIC['tpl'];
815  $this->activateSubTab($this->getParentObject()->getType() . "_members_map");
816  include_once("./Services/Maps/classes/class.ilMapUtil.php");
817  if (!ilMapUtil::isActivated() || !$this->getParentObject()->getEnableMap()) {
818  return;
819  }
820 
821  $map = ilMapUtil::getMapGUI();
822  $map->setMapId("course_map")
823  ->setWidth("700px")
824  ->setHeight("500px")
825  ->setLatitude($this->getParentObject()->getLatitude())
826  ->setLongitude($this->getParentObject()->getLongitude())
827  ->setZoom($this->getParentObject()->getLocationZoom())
828  ->setEnableTypeControl(true)
829  ->setEnableNavigationControl(true)
830  ->setEnableCentralMarker(true);
831 
832  include_once './Services/Membership/classes/class.ilParticipants.php';
833  $members = ilParticipants::getInstanceByObjId($this->getParentObject()->getId())->getParticipants();
834  foreach ((array) $members as $user_id) {
835  $map->addUserMarker($user_id);
836  }
837 
838  $tpl->setContent($map->getHTML());
839  $tpl->setLeftContent($map->getUserListHTML());
840  }
841 
846  protected function mailMembersBtn()
847  {
848  global $DIC;
849 
850  $ilToolbar = $DIC['ilToolbar'];
851 
852  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar'], 'mailMembersBtn');
853  }
854 
855 
856 
857 
861  protected function showParticipantsToolbar()
862  {
863  global $DIC;
864 
865  $ilToolbar = $DIC['ilToolbar'];
866 
867  if ($this->canAddOrSearchUsers()) {
868  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
870  $this,
871  $ilToolbar,
872  array(
873  'auto_complete_name' => $this->lng->txt('user'),
874  'user_type' => $this->getParentGUI()->getLocalRoles(),
875  'user_type_default' => $this->getDefaultRole(),
876  'submit_name' => $this->lng->txt('add')
877  )
878  );
879 
880  // spacer
881  $ilToolbar->addSeparator();
882 
883  // search button
884  $ilToolbar->addButton(
885  $this->lng->txt($this->getParentObject()->getType() . "_search_users"),
886  $this->ctrl->getLinkTargetByClass(
887  'ilRepositorySearchGUI',
888  'start'
889  )
890  );
891 
892  // separator
893  $ilToolbar->addSeparator();
894  }
895 
896  // print button
897  $ilToolbar->addButton(
898  $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
899  $this->ctrl->getLinkTarget($this, 'printMembers')
900  );
901 
902  $this->showMailToMemberToolbarButton($ilToolbar, 'participants', false);
903  }
904 
911  protected function showMemberExportToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
912  {
913  if (
914  $this->getParentObject()->getType() == 'crs' &&
915  $this->getParentObject()->getShowMembersExport()) {
916  if ($a_separator) {
917  $toolbar->addSeparator();
918  }
919 
920  if ($a_back_cmd) {
921  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
922  }
923  $toolbar->addButton(
924  $this->lng->txt($this->getParentObject()->getType() . '_print_list'),
925  $this->ctrl->getLinkTarget($this, 'printForMembersOutput')
926  );
927  }
928  }
929 
930 
931 
932 
933 
937  protected function showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
938  {
939  global $DIC;
940 
941  $ilUser = $DIC['ilUser'];
942  $rbacsystem = $DIC['rbacsystem'];
943  $ilAccess = $DIC['ilAccess'];
944  include_once 'Services/Mail/classes/class.ilMail.php';
945  $mail = new ilMail($ilUser->getId());
946 
947  if (
948  ($this->getParentObject()->getMailToMembersType() == 1) ||
949  (
950  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId()) &&
951  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())
952  )
953  ) {
954  if ($a_separator) {
955  $toolbar->addSeparator();
956  }
957 
958  if ($a_back_cmd) {
959  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
960  }
961 
962  $toolbar->addButton(
963  $this->lng->txt("mail_members"),
964  $this->ctrl->getLinkTargetByClass('ilMailMemberSearchGUI', '')
965  );
966  }
967  }
968 
973  public function createMailSignature()
974  {
975  return $this->getParentGUI()->createMailSignature();
976  }
977 
982  protected function getDefaultCommand()
983  {
984  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
985  'manage_members',
986  'manage_members',
987  $this->getParentObject()->getRefId()
988  );
989  if ($has_manage_members_permission) {
990  return 'participants';
991  }
992 
993  if ($this->getParentObject()->getShowMembers()) {
994  return 'jump2UsersGallery';
995  }
996  return 'mailMembersBtn';
997  }
998 
1004  public function addMemberTab(ilTabsGUI $tabs, $a_is_participant = false)
1005  {
1006  global $DIC;
1007 
1008  $ilAccess = $DIC['ilAccess'];
1009 
1010  include_once './Services/Mail/classes/class.ilMail.php';
1011  $mail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
1012 
1013  $member_tab_name = $this->getMemberTabName();
1014 
1015  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
1016  'manage_members',
1017  'manage_members',
1018  $this->getParentObject()->getRefId()
1019  );
1020 
1021  if ($has_manage_members_permission) {
1022  $tabs->addTab(
1023  'members',
1024  $member_tab_name,
1025  $this->ctrl->getLinkTarget($this, '')
1026  );
1027  } elseif (
1028  (bool) $this->getParentObject()->getShowMembers() && $a_is_participant
1029  ) {
1030  $tabs->addTab(
1031  'members',
1032  $member_tab_name,
1033  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilusersgallerygui'), 'view')
1034  );
1035  } elseif (
1036  $this->getParentObject()->getMailToMembersType() == 1 &&
1037  $GLOBALS['DIC']['rbacsystem']->checkAccess('internal_mail', $mail->getMailObjectReferenceId()) &&
1038  $a_is_participant
1039  ) {
1040  $tabs->addTab(
1041  'members',
1042  $member_tab_name,
1043  $this->ctrl->getLinkTarget($this, "mailMembersBtn")
1044  );
1045  }
1046  }
1047 
1052  protected function getMemberTabName()
1053  {
1054  return $this->lng->txt('members');
1055  }
1056 
1060  protected function setSubTabs(ilTabsGUI $tabs)
1061  {
1062  global $DIC;
1063 
1064  $ilAccess = $DIC['ilAccess'];
1065 
1066  if ($this->checkRbacOrPositionAccessBool('manage_members', 'manage_members', $this->getParentObject()->getRefId())) {
1067  $tabs->addSubTabTarget(
1068  $this->getParentObject()->getType() . "_member_administration",
1069  $this->ctrl->getLinkTarget($this, 'participants'),
1070  "members",
1071  get_class($this)
1072  );
1073 
1074  // show group overview
1075  if ($this instanceof ilCourseMembershipGUI) {
1076  $tabs->addSubTabTarget(
1077  "crs_members_groups",
1078  $this->ctrl->getLinkTargetByClass("ilCourseParticipantsGroupsGUI", "show"),
1079  "",
1080  "ilCourseParticipantsGroupsGUI"
1081  );
1082  }
1083 
1084  $tree = $DIC->repositoryTree();
1085  $children = (array) $tree->getSubTree($tree->getNodeData($this->getParentObject()->getRefId()), false, 'sess');
1086  if (count($children)) {
1087  $tabs->addSubTabTarget(
1088  'events',
1089  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilsessionoverviewgui'), 'listSessions'),
1090  '',
1091  'ilsessionoverviewgui'
1092  );
1093  }
1094 
1095  $tabs->addSubTabTarget(
1096  $this->getParentObject()->getType() . '_members_gallery',
1097  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1098  'view',
1099  'ilUsersGalleryGUI'
1100  );
1101  } elseif ($this->getParentObject()->getShowMembers()) {
1102  // gallery
1103  $tabs->addSubTabTarget(
1104  $this->getParentObject()->getType() . '_members_gallery',
1105  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1106  'view',
1107  'ilUsersGalleryGUI'
1108  );
1109  }
1110 
1111  include_once './Services/Maps/classes/class.ilMapUtil.php';
1112  if (ilMapUtil::isActivated() && $this->getParentObject()->getEnableMap()) {
1113  $tabs->addSubTabTarget(
1114  $this->getParentObject()->getType() . '_members_map',
1115  $this->ctrl->getLinkTarget($this, 'membersMap'),
1116  "membersMap",
1117  get_class($this)
1118  );
1119  }
1120 
1121  include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
1122  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->getRefId())) {
1123  $tabs->addSubTabTarget(
1124  'export_members',
1125  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilmemberexportgui'), 'show'),
1126  '',
1127  'ilmemberexportgui'
1128  );
1129  }
1130  }
1131 
1137  public function readMemberData(array $usr_ids, array $columns)
1138  {
1139  return $this->getParentGUI()->readMemberData($usr_ids, $columns);
1140  }
1141 
1146  public function getLocalRoles()
1147  {
1148  return $this->getParentGUI()->getLocalRoles();
1149  }
1150 
1154  protected function parseSubscriberTable()
1155  {
1156  $subscribers = $this->getMembersObject()->getSubscribers();
1157  $filtered_subscribers = $this->filterUserIdsByRbacOrPositionOfCurrentUser($subscribers);
1158  if (!count($filtered_subscribers)) {
1159  return null;
1160  }
1161  $subscriber = $this->initSubscriberTable();
1162  $subscriber->readSubscriberData(
1163  $filtered_subscribers
1164  );
1165  return $subscriber;
1166  }
1167 
1171  protected function initSubscriberTable()
1172  {
1173  $subscriber = new \ilSubscriberTableGUI($this, $this->getParentObject(), true, true);
1174  $subscriber->setTitle($this->lng->txt('group_new_registrations'));
1175  return $subscriber;
1176  }
1177 
1182  public function confirmAssignSubscribers()
1183  {
1184  if (!is_array($_POST["subscribers"])) {
1185  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1186  $this->ctrl->redirect($this, 'participants');
1187  }
1188 
1189  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1190  $c_gui = new ilConfirmationGUI();
1191 
1192  // set confirm/cancel commands
1193  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
1194  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1195  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1196  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
1197 
1198  foreach ($_POST["subscribers"] as $subscribers) {
1199  $name = ilObjUser::_lookupName($subscribers);
1200 
1201  $c_gui->addItem(
1202  'subscribers[]',
1203  $name['user_id'],
1204  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1205  ilUtil::getImagePath('icon_usr.svg')
1206  );
1207  }
1208 
1209  $this->tpl->setContent($c_gui->getHTML());
1210  return true;
1211  }
1212 
1217  public function confirmRefuseSubscribers()
1218  {
1219  if (!is_array($_POST["subscribers"])) {
1220  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1221  $this->ctrl->redirect($this, 'participants');
1222  }
1223 
1224  $this->lng->loadLanguageModule('mmbr');
1225 
1226  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1227  $c_gui = new ilConfirmationGUI();
1228 
1229  // set confirm/cancel commands
1230  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
1231  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1232  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1233  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
1234 
1235  foreach ($_POST["subscribers"] as $subscribers) {
1236  $name = ilObjUser::_lookupName($subscribers);
1237 
1238  $c_gui->addItem(
1239  'subscribers[]',
1240  $name['user_id'],
1241  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1242  ilUtil::getImagePath('icon_usr.svg')
1243  );
1244  }
1245 
1246  $this->tpl->setContent($c_gui->getHTML());
1247  return true;
1248  }
1249 
1255  protected function refuseSubscribers()
1256  {
1257  global $DIC;
1258 
1259  $rbacsystem = $DIC['rbacsystem'];
1260 
1261  if (!$_POST['subscribers']) {
1262  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1263  $this->ctrl->redirect($this, 'participants');
1264  }
1265 
1266  if (!$this->getMembersObject()->deleteSubscribers($_POST["subscribers"])) {
1267  ilUtil::sendFailure($GLOBALS['DIC']['ilErr']->getMessage(), true);
1268  $this->ctrl->redirect($this, 'participants');
1269  } else {
1270  foreach ($_POST['subscribers'] as $usr_id) {
1271  if ($this instanceof ilCourseMembershipGUI) {
1272  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $usr_id);
1273  }
1274  if ($this instanceof ilGroupMembershipGUI) {
1275  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1276  $this->getMembersObject()->sendNotification(
1278  $usr_id
1279  );
1280  }
1281  if ($this instanceof ilSessionMembershipGUI) {
1283  $noti->setRefId($this->getParentObject()->getRefId());
1284  $noti->setRecipients(array($usr_id));
1286  $noti->send();
1287  }
1288  if ($this instanceof ilLearningSequenceMembershipGUI) {
1289  $this->getMembersObject()->sendNotification(
1291  $usr_id
1292  );
1293  }
1294  }
1295  }
1296 
1297  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_deleted"), true);
1298  $this->ctrl->redirect($this, 'participants');
1299  }
1300 
1307  public function assignSubscribers()
1308  {
1309  global $DIC;
1310 
1311  $ilErr = $DIC['ilErr'];
1312 
1313  if (!is_array($_POST["subscribers"])) {
1314  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1315  $this->ctrl->redirect($this, 'participants');
1316  }
1317 
1318  if (!$this->getMembersObject()->assignSubscribers($_POST["subscribers"])) {
1319  ilUtil::sendFailure($ilErr->getMessage(), true);
1320  $this->ctrl->redirect($this, 'participants');
1321  } else {
1322  foreach ($_POST["subscribers"] as $usr_id) {
1323  if ($this instanceof ilCourseMembershipGUI) {
1324  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_SUBSCRIBER, $usr_id);
1325  $this->getParentObject()->checkLPStatusSync($usr_id);
1326  }
1327  if ($this instanceof ilGroupMembershipGUI) {
1328  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1329  $this->getMembersObject()->sendNotification(
1331  $usr_id
1332  );
1333  }
1334  if ($this instanceof ilSessionMembershipGUI) {
1335  // todo refactor to participants
1336  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1338  $noti->setRefId($this->getParentObject()->getRefId());
1339  $noti->setRecipients(array($usr_id));
1341  $noti->send();
1342  }
1343  }
1344  }
1345  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_assigned"), true);
1346  $this->ctrl->redirect($this, 'participants');
1347  }
1348 
1353  protected function parseWaitingListTable()
1354  {
1355  $wait = $this->initWaitingList();
1356 
1357  $wait_users = $this->filterUserIdsByRbacOrPositionOfCurrentUser($wait->getUserIds());
1358  if (!count($wait_users)) {
1359  return null;
1360  }
1361 
1362  include_once './Services/Membership/classes/class.ilWaitingListTableGUI.php';
1363  $waiting_table = new ilWaitingListTableGUI($this, $this->getParentObject(), $wait);
1364  $waiting_table->setUserIds(
1365  $wait_users
1366  );
1367  $waiting_table->readUserData();
1368  $waiting_table->setTitle($this->lng->txt('crs_waiting_list'));
1369 
1370  return $waiting_table;
1371  }
1372 
1378  {
1379  if (!is_array($_POST["waiting"])) {
1380  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1381  $this->ctrl->redirect($this, 'participants');
1382  }
1383 
1384 
1385  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1386  $c_gui = new ilConfirmationGUI();
1387 
1388  // set confirm/cancel commands
1389  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
1390  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1391  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1392  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
1393 
1394  foreach ($_POST["waiting"] as $waiting) {
1395  $name = ilObjUser::_lookupName($waiting);
1396 
1397  $c_gui->addItem(
1398  'waiting[]',
1399  $name['user_id'],
1400  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1401  ilUtil::getImagePath('icon_usr.svg')
1402  );
1403  }
1404 
1405  $this->tpl->setContent($c_gui->getHTML());
1406  return true;
1407  }
1408 
1414  public function assignFromWaitingList()
1415  {
1416  if (!array_key_exists('waiting', $_POST) || !count($_POST["waiting"])) {
1417  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1418  $this->ctrl->redirect($this, 'participants');
1419  }
1420 
1421  $waiting_list = $this->initWaitingList();
1422 
1423  $added_users = 0;
1424  foreach ($_POST["waiting"] as $user_id) {
1425  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
1426  continue;
1427  }
1428  if ($this->getMembersObject()->isAssigned($user_id)) {
1429  continue;
1430  }
1431 
1432  if ($this instanceof ilCourseMembershipGUI) {
1433  $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
1434  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
1435  $this->getParentObject()->checkLPStatusSync($user_id);
1436  }
1437  if ($this instanceof ilGroupMembershipGUI) {
1438  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1439  $this->getMembersObject()->add($user_id, IL_GRP_MEMBER);
1440  $this->getMembersObject()->sendNotification(
1442  $user_id,
1443  true
1444  );
1445  }
1446  if ($this instanceof ilSessionMembershipGUI) {
1447  $this->getMembersObject()->register($user_id);
1449  $noti->setRefId($this->getParentObject()->getRefId());
1450  $noti->setRecipients(array($user_id));
1452  $noti->send();
1453  }
1454 
1455  $waiting_list->removeFromList($user_id);
1456  ++$added_users;
1457  }
1458 
1459  if ($added_users) {
1460  ilUtil::sendSuccess($this->lng->txt("crs_users_added"), true);
1461  $this->ctrl->redirect($this, 'participants');
1462  } else {
1463  ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"), true);
1464  $this->ctrl->redirect($this, 'participants');
1465  }
1466  }
1467 
1472  public function confirmRefuseFromList()
1473  {
1474  if (!is_array($_POST["waiting"])) {
1475  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1476  $this->ctrl->redirect($this, 'participants');
1477  }
1478 
1479  $this->lng->loadLanguageModule('mmbr');
1480 
1481  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1482  $c_gui = new ilConfirmationGUI();
1483 
1484  // set confirm/cancel commands
1485  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
1486  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1487  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1488  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
1489 
1490  foreach ($_POST["waiting"] as $waiting) {
1491  $name = ilObjUser::_lookupName($waiting);
1492 
1493  $c_gui->addItem(
1494  'waiting[]',
1495  $name['user_id'],
1496  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1497  ilUtil::getImagePath('icon_usr.svg')
1498  );
1499  }
1500 
1501  $this->tpl->setContent($c_gui->getHTML());
1502  return true;
1503  }
1504 
1511  protected function refuseFromList()
1512  {
1513  if (!array_key_exists('waiting', $_POST) || !count($_POST['waiting'])) {
1514  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
1515  $this->ctrl->redirect($this, 'participants');
1516  }
1517 
1518  $waiting_list = $this->initWaitingList();
1519 
1520  foreach ($_POST["waiting"] as $user_id) {
1521  $waiting_list->removeFromList($user_id);
1522 
1523  if ($this instanceof ilCourseMembershipGUI) {
1524  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $user_id, true);
1525  }
1526  if ($this instanceof ilGroupMembershipGUI) {
1527  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1528  $this->getMembersObject()->sendNotification(
1530  $user_id,
1531  true
1532  );
1533  }
1534  if ($this instanceof ilSessionMembershipGUI) {
1535  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1537  $noti->setRefId($this->getParentObject()->getRefId());
1538  $noti->setRecipients(array($user_id));
1540  $noti->send();
1541  }
1542  }
1543  ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'), true);
1544  $this->ctrl->redirect($this, 'participants');
1545  }
1546 
1550  protected function addToClipboard()
1551  {
1552  // begin-patch clipboard
1553  $users = [];
1554  if (isset($_POST['participants'])) {
1555  $users = (array) $_POST['participants'];
1556  } elseif (isset($_POST['subscribers'])) {
1557  $users = (array) $_POST['subscribers'];
1558  } elseif (isset($_POST['waiting'])) {
1559  $users = (array) $_POST['waiting'];
1560  }
1561  // end-patch clipboard
1562  if (!count($users)) {
1563  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1564  $this->ctrl->redirect($this, 'participants');
1565  }
1566  include_once './Services/User/classes/class.ilUserClipboard.php';
1567  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
1568  $clip->add($users);
1569  $clip->save();
1570 
1571  $this->lng->loadLanguageModule('user');
1572  ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
1573  $this->ctrl->redirect($this, 'participants');
1574  }
1575 
1579  protected function getDefaultRole()
1580  {
1581  return null;
1582  }
1583 
1587  protected function activateSubTab($a_sub_tab)
1588  {
1592  $tabs = $GLOBALS['DIC']['ilTabs'];
1593  $tabs->activateSubTab($a_sub_tab);
1594  }
1595 
1596 
1597 
1598 
1603  protected function printMembers()
1604  {
1605  global $DIC;
1606 
1607  $ilTabs = $DIC['ilTabs'];
1608 
1609  $this->checkPermission('read');
1610 
1611  $ilTabs->clearTargets();
1612 
1613  $ilTabs->setBackTarget(
1614  $this->lng->txt('back'),
1615  $this->ctrl->getLinkTarget($this, 'participants')
1616  );
1617 
1618  $list = $this->initAttendanceList();
1619  $form = $list->initForm('printMembersOutput');
1620  $this->tpl->setContent($form->getHTML());
1621  }
1622 
1626  protected function printMembersOutput()
1627  {
1628  global $DIC;
1629 
1630  $tabs = $DIC->tabs();
1631  $tabs->clearTargets();
1632  $tabs->setBackTarget(
1633  $this->lng->txt('back'),
1634  $this->ctrl->getLinkTarget($this, 'participants')
1635  );
1636 
1637  $list = $this->initAttendanceList();
1638  $list->initFromForm();
1639  $list->setCallback(array($this, 'getAttendanceListUserData'));
1640  $this->member_data = $this->getPrintMemberData(
1642  $this->getMembersObject()->getParticipants()
1643  )
1644  );
1645 
1646  $list->getNonMemberUserData($this->member_data);
1647  $list->getFullscreenHTML();
1648  }
1649 
1653  protected function printForMembersOutput()
1654  {
1655  global $DIC;
1656 
1657  $tabs = $DIC->tabs();
1658  $tabs->clearTargets();
1659  $tabs->setBackTarget(
1660  $this->lng->txt('back'),
1661  $this->ctrl->getLinkTarget($this, 'jump2UsersGallery')
1662  );
1663 
1664  $list = $this->initAttendanceList();
1665  $list->setTitle($this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle());
1666  $list->setId(0);
1667  $form = $list->initForm('printForMembersOutput');
1668  $list->initFromForm();
1669  $list->setCallback(array($this, 'getAttendanceListUserData'));
1670  $this->member_data = $this->getPrintMemberData($this->getMembersObject()->getParticipants());
1671  $list->getNonMemberUserData($this->member_data);
1672 
1673  $list->getFullscreenHTML();
1674  }
1675 
1679  protected function jump2UsersGallery()
1680  {
1681  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
1682  }
1683 
1684 
1685 
1686 
1690  protected function initAttendanceList($a_for_members = false)
1691  {
1692  global $DIC;
1693 
1697  $waiting_list = $this->initWaitingList();
1698 
1699  if ($this instanceof ilSessionMembershipGUI) {
1700  $member_id = $DIC->repositoryTree()->checkForParentType(
1701  $this->getParentObject()->getRefId(),
1702  'grp'
1703  );
1704  if (!$member_id) {
1705  $member_id = $DIC->repositoryTree()->checkForParentType(
1706  $this->getParentObject()->getRefId(),
1707  'crs'
1708  );
1709  }
1710  if (!$member_id) {
1711  $DIC->logger()->sess()->warning('Cannot find parent course or group for ref_id: ' . $this->getParentObject()->getRefId());
1712  $member_id = $this->getParentObject()->getRefId();
1713  }
1714  $part = ilParticipants::getInstance($member_id);
1715 
1716  $list = new ilAttendanceList(
1717  $this,
1718  $this->getParentObject(),
1719  $part,
1720  $waiting_list
1721  );
1722  } else {
1723  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1724  $list = new ilAttendanceList(
1725  $this,
1726  $this->getParentObject(),
1727  $this->getMembersObject(),
1728  $waiting_list
1729  );
1730  }
1731  $list->setId($this->getParentObject()->getType() . '_memlist_' . $this->getParentObject()->getId());
1732 
1733  $list->setTitle(
1734  $this->lng->txt($this->getParentObject()->getType() . '_members_print_title'),
1735  $this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle()
1736  );
1737 
1738  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
1739  $show_tracking =
1741  if ($show_tracking) {
1742  include_once('./Services/Object/classes/class.ilObjectLP.php');
1743  $olp = ilObjectLP::getInstance($this->getParentObject()->getId());
1744  $show_tracking = $olp->isActive();
1745  }
1746  if ($show_tracking) {
1747  $list->addPreset('progress', $this->lng->txt('learning_progress'), true);
1748  }
1749 
1750  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1754  $privacy = ilPrivacySettings::_getInstance();
1755  if ($privacy->enabledAccessTimesByType($this->getParentObject()->getType())) {
1756  $list->addPreset('access', $this->lng->txt('last_access'), true);
1757  }
1758 
1759  switch ($this->getParentObject()->getType()) {
1760  case 'crs':
1761  $list->addPreset('status', $this->lng->txt('crs_status'), true);
1762  $list->addPreset('passed', $this->lng->txt('crs_passed'), true);
1763  break;
1764 
1765  case 'sess':
1766  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1767  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1768  if ($this->getParentObject()->enabledRegistration()) {
1769  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1770  }
1771  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1772  $list->addBlank($this->lng->txt('sess_signature'));
1773 
1774  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1775  break;
1776 
1777  case 'grp':
1778  default:
1779  break;
1780  }
1781 
1782  return $list;
1783  }
1784 }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
readMemberData(array $usr_ids, array $columns)
Required for member table guis.
Class ilCourseParticipantsGroupsGUI.
setSubTabs(ilTabsGUI $tabs)
Set sub tabs.
Base class for member tab content.
confirmDeleteParticipants()
Show confirmation screen for participants deletion.
addSubTabTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
static getInstance($a_usr_id)
Get singelton instance.
printMembersOutput()
print members output
addToClipboard()
Add selected users to user clipboard.
Tabs GUI.
printMembers()
Print members.
getMembersObject()
Get member object.
$_GET["client_id"]
updateParticipants()
update members
assignFromWaitingList()
Assign from waiting list type $rbacsystem.
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
participantsResetFilter()
reset participants filter
ilUsersGalleryGUI: ilPublicUserProfileGUI ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI
confirmAssignSubscribers()
Show subscription confirmation.
editMember()
Edit one participant.
__construct(ilObjectGUI $repository_gui, ilObject $repository_obj)
Constructor.
Class ilMailMemberSearchGUI.
printForMembersOutput()
print members output
const IL_GRP_MEMBER
checkPermission($a_permission, $a_cmd="")
Check permission If not granted redirect to parent gui.
parseWaitingListTable()
Parse table of subscription request.
static isReferenceMemberUpdateConfirmationRequired(int $course_ref_id, array $participants)
$ilErr
Definition: raiseError.php:18
Base class for attendance lists.
getLocalRoles()
Get parent roles.
const IL_CRS_MEMBER
static getInstance($a_ref_id)
Get instance by ref_id.
refuseSubscribers()
Refuse subscribers type $rbacsystem.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
Show mail to member toolbar button.
if($format !==null) $name
Definition: metadata.php:230
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getMapGUI()
Get an instance of the GUI class.
assignSubscribers()
Do assignment of subscription request type $rbacsystem type $ilErr.
GUI class for membership features.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjectGUI Basic methods of all Output classes.
checkRbacOrPermissionAccess($a_rbac_perm, $a_pos_perm)
check rbac or position access
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
GUI class for course/group subscriptions.
sendMailToSelectedUsers()
Send mail to selected users.
getParentGUI()
Get parent gui.
addSeparator()
Add separator.
confirmAssignFromWaitingList()
Assign from waiting list (confirmatoin)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilUsersGalleryParticipants.
showParticipantsToolbar()
Show participants toolbar.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
showMemberExportToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
Show member export button.
confirmRefuseSubscribers()
Refuse subscriber confirmation.
static isActivated()
Checks whether Map feature is activated.
parseSubscriberTable()
Parse table of subscription request.
static setRecipients(array $recipients, string $type='to')
mailMembersBtn()
Mail to members view type $ilToolbar.
getDefaultCommand()
Get default command.
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
$ret
Definition: parser.php:6
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
GUI class for course/group waiting list.
addMemberTab(ilTabsGUI $tabs, $a_is_participant=false)
add member tab
participants()
Show participant table, subscriber table, wating list table;.
addTab($a_id, $a_text, $a_link, $a_frame="")
Add a Tab.
refuseFromList()
refuse from waiting list
membersMap()
Members map.
static _getInstance()
Get instance of ilPrivacySettings.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
getParentObject()
Get parent object.
$ilUser
Definition: imgupload.php:18
editParticipants($post_participants=array())
Edit participants.
confirmRefuseFromList()
Refuse from waiting list (confirmation)
getMemberTabName()
Get member tab name.
filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
Filter user ids by access.
static redirect($a_script)
static getInstance($a_obj_id)
if(! $in) $columns
Definition: Utf8Test.php:45
canAddOrSearchUsers()
Check if current user is allowed to add / search users.
$_POST["username"]
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
Check if rbac or position access is granted.
GUI class for learning sequence membership features.
participantsApplyFilter()
Apply filter for participant table.
Confirmation screen class.