ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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->tpl = $GLOBALS['DIC']->ui()->mainTemplate();
64  $this->ctrl = $GLOBALS['DIC']->ctrl();
65  $this->logger = $DIC->logger()->mmbr();
66  $this->access = $GLOBALS['DIC']->access();
67  }
68 
72  protected function getLanguage()
73  {
74  return $this->lng;
75  }
76 
80  protected function getCtrl()
81  {
82  return $this->ctrl;
83  }
84 
88  protected function getLogger()
89  {
90  return $this->logger;
91  }
92 
93 
98  public function getParentGUI()
99  {
100  return $this->repository_gui;
101  }
102 
107  public function getParentObject()
108  {
110  }
111 
116  public function getMembersObject()
117  {
118  if ($this->participants instanceof ilParticipants) {
119  return $this->participants;
120  }
121  return $this->participants = ilParticipants::getInstance($this->getParentObject()->getRefId());
122  }
123 
127  protected function getMailMemberRoles()
128  {
129  return null;
130  }
131 
139  protected function checkPermissionBool($a_permission, $a_cmd = '', $a_type = '', $a_ref_id = 0)
140  {
141  if (!$a_ref_id) {
142  $a_ref_id = $this->getParentObject()->getRefId();
143  }
144  return $this->access->checkAccess($a_permission, $a_cmd, $a_ref_id);
145  }
146 
153  protected function checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id = 0)
154  {
155  if (!$a_ref_id) {
156  $a_ref_id = $this->getParentObject()->getRefId();
157  }
158  return $this->access->checkRbacOrPositionPermissionAccess($a_rbac_perm, $a_pos_perm, $a_ref_id);
159  }
160 
168  protected function checkPermission($a_permission, $a_cmd = "")
169  {
170  if (!$this->checkPermissionBool($a_permission, $a_cmd)) {
171  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
172  $this->ctrl->redirect($this->getParentGUI());
173  }
174  }
175 
182  protected function checkRbacOrPermissionAccess($a_rbac_perm, $a_pos_perm)
183  {
184  if (!$this->checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm)) {
185  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
186  $this->ctrl->redirect($this->getParentGUI());
187  }
188  }
189 
190 
191 
196  protected function canAddOrSearchUsers()
197  {
198  return $this->checkPermissionBool('manage_members');
199  }
200 
201 
207  public function filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
208  {
209  return $a_user_ids;
210  }
211 
215  public function executeCommand()
216  {
220  global $DIC;
221 
222  $ilUser = $DIC['ilUser'];
223  $ilErr = $DIC['ilErr'];
224  $ilAccess = $DIC['ilAccess'];
225  $rbacsystem = $DIC['rbacsystem'];
226  $ilTabs = $DIC['ilTabs'];
227 
228  $cmd = $this->ctrl->getCmd('participants');
229  $next_class = $this->ctrl->getNextClass();
230 
231  switch ($next_class) {
232  case 'ilrepositorysearchgui':
233 
234  $this->checkPermission('manage_members');
235 
236  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
237  include_once './Services/Membership/classes/class.ilParticipants.php';
238  $rep_search = new ilRepositorySearchGUI();
239  $rep_search->addUserAccessFilterCallable([$this,'filterUserIdsByRbacOrPositionOfCurrentUser']);
240 
241  $participants = $this->getMembersObject();
242  if (
243  $participants->isAdmin($GLOBALS['DIC']['ilUser']->getId()) ||
244  $ilAccess->checkAccess('manage_members', '', $this->getParentObject()->getRefId())
245  ) {
246  $rep_search->setCallback(
247  $this,
248  'assignMembers',
249  $this->getParentGUI()->getLocalRoles()
250  );
251  } else {
252  //#18445 excludes admin role
253  $rep_search->setCallback(
254  $this,
255  'assignMembers',
256  $this->getLocalRoles(array($this->getParentObject()->getDefaultAdminRole()))
257  );
258  }
259 
260  // Set tabs
261  $this->ctrl->setReturn($this, 'participants');
262  $ret = $this->ctrl->forwardCommand($rep_search);
263  break;
264 
265 
266  case 'ilmailmembersearchgui':
267  $ilTabs->clearTargets();
268  $ilTabs->setBackTarget(
269  $this->lng->txt('btn_back'),
270  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
271  );
272 
273  $mail = new ilMail($ilUser->getId());
274  if (!(
275  $this->getParentObject()->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
276  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId())
277  ) ||
278  !$rbacsystem->checkAccess(
279  'internal_mail',
280  $mail->getMailObjectReferenceId()
281  )) {
282  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
283  }
284 
285  $mail_search = new ilMailMemberSearchGUI(
286  $this,
287  $this->getParentObject()->getRefId(),
288  $this->getMailMemberRoles()
289  );
290  $mail_search->setObjParticipants(
291  ilParticipants::getInstance($this->getParentObject()->getRefId())
292  );
293  $this->ctrl->forwardCommand($mail_search);
294  break;
295 
296  case 'ilusersgallerygui':
297 
298  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
299  $tabs = $GLOBALS['DIC']->tabs()->setSubTabActive(
300  $this->getParentObject()->getType() . '_members_gallery'
301  );
302 
303  $is_admin = (bool) $this->checkRbacOrPositionAccessBool('manage_members', 'manage_members');
304  $is_participant = (bool) ilParticipants::_isParticipant($this->getParentObject()->getRefId(), $ilUser->getId());
305  if (
306  !$is_admin &&
307  (
308  $this->getParentObject()->getShowMembers() == 0 ||
309  !$is_participant
310  )
311  ) {
312  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
313  }
314 
315  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar'], 'jump2UsersGallery');
316  $this->showMemberExportToolbarButton($GLOBALS['DIC']['ilToolbar'], 'jump2UsersGallery');
317 
318  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryGUI.php';
319  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryParticipants.php';
320 
321 
323  $gallery_gui = new ilUsersGalleryGUI($provider);
324  $this->ctrl->forwardCommand($gallery_gui);
325  break;
326 
327  case 'ilcourseparticipantsgroupsgui':
328 
329  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
330  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
331 
332 
333  include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
334  $cmg_gui = new ilCourseParticipantsGroupsGUI($this->getParentObject()->getRefId());
335  if ($cmd == "show" || $cmd = "") {
336  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar']);
337  }
338  $this->ctrl->forwardCommand($cmg_gui);
339  break;
340 
341  case 'ilsessionoverviewgui':
342 
343  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
344  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
345 
346  include_once './Services/Membership/classes/class.ilParticipants.php';
347  $prt = ilParticipants::getInstance($this->getParentObject()->getRefId());
348 
349  include_once('./Modules/Session/classes/class.ilSessionOverviewGUI.php');
350  $overview = new ilSessionOverviewGUI($this->getParentObject()->getRefId(), $prt);
351  $this->ctrl->forwardCommand($overview);
352  break;
353 
354  case 'ilmemberexportgui':
355 
356  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
357  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
358 
359  include_once('./Services/Membership/classes/Export/class.ilMemberExportGUI.php');
360  $export = new ilMemberExportGUI($this->getParentObject()->getRefId());
361  $this->ctrl->forwardCommand($export);
362  break;
363 
364  case 'ilobjectcustomuserfieldsgui':
365 
366  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
367  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
368  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
369  $this->ctrl->setReturn($this, 'participants');
370 
371  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
372  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->getParentGUI()->object->getId());
373  $this->ctrl->forwardCommand($cdf_gui);
374  break;
375 
376  default:
377 
378  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
379 
380  //exclude mailMembersBtn cmd from this check
381  if (
382  $cmd == "mailMembersBtn" ||
383  $cmd == 'membersMap' ||
384  $cmd == 'printForMembersOutput' ||
385  $cmd == 'jump2UsersGallery'
386  ) {
387  $this->checkPermission('read');
388  } else {
389  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
390  }
391 
392  $this->$cmd();
393  break;
394  }
395  }
396 
400  protected function participants()
401  {
402  $this->initParticipantTemplate();
403  $this->showParticipantsToolbar();
404  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
405 
406  // show waiting list table
407  $waiting = $this->parseWaitingListTable();
408  if ($waiting instanceof ilWaitingListTableGUI) {
409  $this->tpl->setVariable('TABLE_WAIT', $waiting->getHTML());
410  }
411 
412  // show subscriber table
413  $subscriber = $this->parseSubscriberTable();
414  if ($subscriber instanceof ilSubscriberTableGUI) {
415  $this->tpl->setVariable('TABLE_SUB', $subscriber->getHTML());
416  }
417 
418  // show member table
419  $table = $this->initParticipantTableGUI();
420  $table->setTitle($this->lng->txt($this->getParentObject()->getType() . '_mem_tbl_header'));
421  $table->setFormAction($this->ctrl->getFormAction($this));
422  $table->parse();
423 
424  // filter commands
425  $table->setFilterCommand('participantsApplyFilter');
426  $table->setResetCommand('participantsResetFilter');
427 
428  $this->tpl->setVariable('MEMBERS', $table->getHTML());
429  }
430 
434  protected function participantsApplyFilter()
435  {
436  $table = $this->initParticipantTableGUI();
437  $table->resetOffset();
438  $table->writeFilterToSession();
439 
440  $this->participants();
441  }
442 
446  protected function participantsResetFilter()
447  {
448  $table = $this->initParticipantTableGUI();
449  $table->resetOffset();
450  $table->resetFilter();
451 
452  $this->participants();
453  }
454 
455 
459  protected function editMember()
460  {
461  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
462  return $this->editParticipants(array($_REQUEST['member_id']));
463  }
464 
469  protected function editParticipants($post_participants = array())
470  {
471  if (!$post_participants) {
472  $post_participants = (array) $_POST['participants'];
473  }
474 
475  $real_participants = $this->getMembersObject()->getParticipants();
476  $participants = array_intersect((array) $post_participants, (array) $real_participants);
477 
478  if (!count($participants)) {
479  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
480  $this->ctrl->redirect($this, 'participants');
481  }
482  $table = $this->initEditParticipantTableGUI($participants);
483  $this->tpl->setContent($table->getHTML());
484  return true;
485  }
486 
494  public function updateParticipants()
495  {
496  global $DIC;
497 
498  $rbacsystem = $DIC['rbacsystem'];
499  $rbacreview = $DIC['rbacreview'];
500  $ilUser = $DIC['ilUser'];
501  $ilAccess = $DIC['ilAccess'];
502 
503  if (!array_key_exists('participants', $_POST) || !count($_POST['participants'])) {
504  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
505  $this->ctrl->redirect($this, 'participants');
506  }
507 
508  $notifications = $_POST['notification'] ? $_POST['notification'] : array();
509  $passed = $_POST['passed'] ? $_POST['passed'] : array();
510  $blocked = $_POST['blocked'] ? $_POST['blocked'] : array();
511  $contact = $_POST['contact'] ? $_POST['contact'] : array();
512 
513  // Determine whether the user has the 'edit_permission' permission
514  $hasEditPermissionAccess =
515  (
516  $ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) or
517  $this->getMembersObject()->isAdmin($ilUser->getId())
518  );
519 
520  // Get all assignable local roles of the object, and
521  // determine the role id of the course administrator role.
522  $assignableLocalRoles = array();
523  $adminRoleId = $this->getParentObject()->getDefaultAdminRole();
524  foreach ($this->getLocalTypeRole(false) as $title => $role_id) {
525  $assignableLocalRoles[$role_id] = $title;
526  }
527 
528  // Validate the user ids and role ids in the post data
529  foreach ($_POST['participants'] as $usr_id) {
530  $memberIsAdmin = $rbacreview->isAssigned($usr_id, $adminRoleId);
531 
532  // If the current user doesn't have the 'edit_permission'
533  // permission, make sure he doesn't remove the course
534  // administrator role of members who are course administrator.
535  if (!$hasEditPermissionAccess && $memberIsAdmin &&
536  !in_array($adminRoleId, $_POST['roles'][$usr_id])
537  ) {
538  $_POST['roles'][$usr_id][] = $adminRoleId;
539  }
540 
541  // Validate the role ids in the post data
542  foreach ((array) $_POST['roles'][$usr_id] as $role_id) {
543  if (!array_key_exists($role_id, $assignableLocalRoles)) {
544  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
545  $this->ctrl->redirect($this, 'participants');
546  }
547  if (!$hasEditPermissionAccess &&
548  $role_id == $adminRoleId &&
549  !$memberIsAdmin) {
550  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'));
551  $this->ctrl->redirect($this, 'participants');
552  }
553  }
554  }
555 
556  $has_admin = false;
557  foreach ($this->getMembersObject()->getAdmins() as $admin_id) {
558  if (!isset($_POST['roles'][$admin_id])) {
559  $has_admin = true;
560  break;
561  }
562  if (in_array($adminRoleId, $_POST['roles'][$admin_id])) {
563  $has_admin = true;
564  break;
565  }
566  }
567 
568  if (!$has_admin && is_array($_POST['roles'])) {
569  foreach ($_POST['roles'] as $usrId => $roleIdsToBeAssigned) {
570  if (in_array($adminRoleId, $roleIdsToBeAssigned)) {
571  $has_admin = true;
572  break;
573  }
574  }
575  }
576 
577  if (!$has_admin) {
578  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_min_one_admin'), true);
579  $this->ctrl->redirect($this, 'participants');
580  }
581 
582  foreach ($_POST['participants'] as $usr_id) {
583  $this->getMembersObject()->updateRoleAssignments($usr_id, (array) $_POST['roles'][$usr_id]);
584 
585  // Disable notification for all of them
586  $this->getMembersObject()->updateNotification($usr_id, 0);
587  if (($this->getMembersObject()->isTutor($usr_id) or $this->getMembersObject()->isAdmin($usr_id)) and in_array($usr_id, $notifications)) {
588  $this->getMembersObject()->updateNotification($usr_id, 1);
589  }
590 
591  $this->getMembersObject()->updateBlocked($usr_id, 0);
592  if ((!$this->getMembersObject()->isAdmin($usr_id) and !$this->getMembersObject()->isTutor($usr_id)) and in_array($usr_id, $blocked)) {
593  $this->getMembersObject()->updateBlocked($usr_id, 1);
594  }
595 
596  if ($this instanceof ilCourseMembershipGUI) {
597  $this->getMembersObject()->updatePassed($usr_id, in_array($usr_id, $passed), true);
598  $this->getMembersObject()->sendNotification(
599  $this->getMembersObject()->NOTIFY_STATUS_CHANGED,
600  $usr_id
601  );
602  }
603 
604  if (
605  ($this->getMembersObject()->isAdmin($usr_id) ||
606  $this->getMembersObject()->isTutor($usr_id)) &&
607  in_array($usr_id, $contact)
608  ) {
609  $this->getMembersObject()->updateContact($usr_id, true);
610  } else {
611  $this->getMembersObject()->updateContact($usr_id, false);
612  }
613 
614  $this->updateLPFromStatus($usr_id, in_array($usr_id, $passed));
615  }
616  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
617  $this->ctrl->redirect($this, "participants");
618  }
619 
623  protected function confirmDeleteParticipants()
624  {
625  global $DIC;
626 
627  $ilAccess = $DIC['ilAccess'];
628  $ilUser = $DIC['ilUser'];
629 
630  $participants = (array) $_POST['participants'];
631 
632  if (!count($participants)) {
633  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
634  $this->ctrl->redirect($this, 'participants');
635  }
636 
637  // Check last admin
638  if (!$this->getMembersObject()->checkLastAdmin($participants)) {
639  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_at_least_one_admin'), true);
640  $this->ctrl->redirect($this, 'participants');
641  }
642 
643  // if only position access is granted, show additional info
644  if (!$this->checkPermissionBool('manage_members')) {
645  $this->lng->loadLanguageModule('rbac');
646  ilUtil::sendInfo($this->lng->txt('rbac_info_only_position_access'));
647  }
648 
649 
650  // Access check for admin deletion
651  if (
652  !$ilAccess->checkAccess(
653  'edit_permission',
654  '',
655  $this->getParentObject()->getRefId()
656  ) &&
657  !$this->getMembersObject()->isAdmin($GLOBALS['DIC']['ilUser']->getId())
658  ) {
659  foreach ($participants as $usr_id) {
660  if ($this->getMembersObject()->isAdmin($usr_id)) {
661  ilUtil::sendFailure($this->lng->txt("msg_no_perm_perm"), true);
662  $this->ctrl->redirect($this, 'participants');
663  }
664  }
665  }
666 
667 
668  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
669  $confirm = new ilConfirmationGUI();
670  $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
671  $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
672  $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
673  $confirm->setCancel($this->lng->txt('cancel'), 'participants');
674 
675  foreach ($participants as $usr_id) {
676  $name = ilObjUser::_lookupName($usr_id);
677 
678  $confirm->addItem(
679  'participants[]',
680  $name['user_id'],
681  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
682  ilUtil::getImagePath('icon_usr.svg')
683  );
684  }
685 
686  $this->tpl->setContent($confirm->getHTML());
687  }
688 
689  protected function deleteParticipants()
690  {
691  global $DIC;
692 
693  $rbacreview = $DIC['rbacreview'];
694  $rbacsystem = $DIC['rbacsystem'];
695  $ilAccess = $DIC['ilAccess'];
696  $ilUser = $DIC['ilUser'];
697 
698  $participants = (array) $_POST['participants'];
699 
700  if (!is_array($participants) or !count($participants)) {
701  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
702  $this->ctrl->redirect($this, 'participants');
703  }
704 
705  // If the user doesn't have the edit_permission and is not administrator, he may not remove
706  // members who have the course administrator role
707  if (
708  !$ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) &&
709  !$this->getMembersObject()->isAdmin($GLOBALS['DIC']['ilUser']->getId())
710  ) {
711  foreach ($participants as $part) {
712  if ($this->getMembersObject()->isAdmin($part)) {
713  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
714  $this->ctrl->redirect($this, 'participants');
715  }
716  }
717  }
718 
719  if (!$this->getMembersObject()->deleteParticipants($participants)) {
720  ilUtil::sendFailure('Error deleting participants.', true);
721  $this->ctrl->redirect($this, 'participants');
722  } else {
723  foreach ((array) $_POST["participants"] as $usr_id) {
724  $mail_type = 0;
725  // @todo more generic
726  switch ($this->getParentObject()->getType()) {
727  case 'crs':
728  $mail_type = $this->getMembersObject()->NOTIFY_DISMISS_MEMBER;
729  break;
730  case 'grp':
731  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
733  break;
734  case 'lso':
736  break;
737  }
738  $this->getMembersObject()->sendNotification($mail_type, $usr_id);
739  }
740  }
741  ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
742  $this->ctrl->redirect($this, "participants");
743 
744  return true;
745  }
746 
750  protected function sendMailToSelectedUsers()
751  {
752  $participants = [];
753  if ($_POST['participants']) {
754  $participants = (array) $_POST['participants'];
755  } elseif ($_GET['member_id']) {
756  $participants = array($_GET['member_id']);
757  } elseif ($_POST['subscribers']) {
758  $participants = (array) $_POST['subscribers'];
759  } elseif ($_POST['waiting']) {
760  $participants = (array) $_POST['waiting'];
761  }
762 
763  if (!count($participants)) {
764  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
765  $this->ctrl->redirect($this, 'participants');
766  }
767 
768  foreach ($participants as $usr_id) {
769  $rcps[] = ilObjUser::_lookupLogin($usr_id);
770  }
771 
772 
773  $context_options = $this->getMailContextOptions();
774 
778  $this,
779  'participants',
780  array(),
781  array(
782  'type' => 'new',
783  'sig' => $this->createMailSignature()
784  ),
785  $context_options
786  )
787  );
788  }
789 
794  protected function getMailContextOptions()
795  {
796  $context_options = [];
797  return $context_options;
798  }
799 
800 
804  protected function membersMap()
805  {
806  global $DIC;
807 
808  $tpl = $DIC['tpl'];
809  $this->activateSubTab($this->getParentObject()->getType() . "_members_map");
810  include_once("./Services/Maps/classes/class.ilMapUtil.php");
811  if (!ilMapUtil::isActivated() || !$this->getParentObject()->getEnableMap()) {
812  return;
813  }
814 
816  $map->setMapId("course_map")
817  ->setWidth("700px")
818  ->setHeight("500px")
819  ->setLatitude($this->getParentObject()->getLatitude())
820  ->setLongitude($this->getParentObject()->getLongitude())
821  ->setZoom($this->getParentObject()->getLocationZoom())
822  ->setEnableTypeControl(true)
823  ->setEnableNavigationControl(true)
824  ->setEnableCentralMarker(true);
825 
826  include_once './Services/Membership/classes/class.ilParticipants.php';
827  $members = ilParticipants::getInstanceByObjId($this->getParentObject()->getId())->getParticipants();
828  foreach ((array) $members as $user_id) {
829  $map->addUserMarker($user_id);
830  }
831 
832  $tpl->setContent($map->getHTML());
833  $tpl->setLeftContent($map->getUserListHTML());
834  }
835 
840  protected function mailMembersBtn()
841  {
842  global $DIC;
843 
844  $ilToolbar = $DIC['ilToolbar'];
845 
846  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar'], 'mailMembersBtn');
847  }
848 
849 
850 
851 
855  protected function showParticipantsToolbar()
856  {
857  global $DIC;
858 
859  $ilToolbar = $DIC['ilToolbar'];
860 
861  if ($this->canAddOrSearchUsers()) {
862  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
864  $this,
865  $ilToolbar,
866  array(
867  'auto_complete_name' => $this->lng->txt('user'),
868  'user_type' => $this->getParentGUI()->getLocalRoles(),
869  'user_type_default' => $this->getDefaultRole(),
870  'submit_name' => $this->lng->txt('add')
871  )
872  );
873 
874  // spacer
875  $ilToolbar->addSeparator();
876 
877  // search button
878  $ilToolbar->addButton(
879  $this->lng->txt($this->getParentObject()->getType() . "_search_users"),
880  $this->ctrl->getLinkTargetByClass(
881  'ilRepositorySearchGUI',
882  'start'
883  )
884  );
885 
886  // separator
887  $ilToolbar->addSeparator();
888  }
889 
890  // print button
891  $ilToolbar->addButton(
892  $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
893  $this->ctrl->getLinkTarget($this, 'printMembers')
894  );
895 
896  $this->showMailToMemberToolbarButton($ilToolbar, 'participants', false);
897  }
898 
905  protected function showMemberExportToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
906  {
907  if (
908  $this->getParentObject()->getType() == 'crs' &&
909  $this->getParentObject()->getShowMembersExport()) {
910  if ($a_separator) {
911  $toolbar->addSeparator();
912  }
913 
914  if ($a_back_cmd) {
915  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
916  }
917  $toolbar->addButton(
918  $this->lng->txt($this->getParentObject()->getType() . '_print_list'),
919  $this->ctrl->getLinkTarget($this, 'printForMembersOutput')
920  );
921  }
922  }
923 
924 
925 
926 
927 
931  protected function showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
932  {
933  global $DIC;
934 
935  $ilUser = $DIC['ilUser'];
936  $rbacsystem = $DIC['rbacsystem'];
937  $ilAccess = $DIC['ilAccess'];
938  include_once 'Services/Mail/classes/class.ilMail.php';
939  $mail = new ilMail($ilUser->getId());
940 
941  if (
942  ($this->getParentObject()->getMailToMembersType() == 1) ||
943  (
944  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId()) &&
945  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())
946  )
947  ) {
948  if ($a_separator) {
949  $toolbar->addSeparator();
950  }
951 
952  if ($a_back_cmd) {
953  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
954  }
955 
956  $toolbar->addButton(
957  $this->lng->txt("mail_members"),
958  $this->ctrl->getLinkTargetByClass('ilMailMemberSearchGUI', '')
959  );
960  }
961  }
962 
967  public function createMailSignature()
968  {
969  return $this->getParentGUI()->createMailSignature();
970  }
971 
976  protected function getDefaultCommand()
977  {
978  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
979  'manage_members',
980  'manage_members',
981  $this->getParentObject()->getRefId()
982  );
983  if ($has_manage_members_permission) {
984  return 'participants';
985  }
986 
987  if ($this->getParentObject()->getShowMembers()) {
988  return 'jump2UsersGallery';
989  }
990  return 'mailMembersBtn';
991  }
992 
993 
998  public function addMemberTab(ilTabsGUI $tabs, $a_is_participant = false)
999  {
1000  global $DIC;
1001 
1002  $ilAccess = $DIC['ilAccess'];
1003 
1004  include_once './Services/Mail/classes/class.ilMail.php';
1005  $mail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
1006 
1007  $member_tab_name = $this->getMemberTabName();
1008 
1009  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
1010  'manage_members',
1011  'manage_members',
1012  $this->getParentObject()->getRefId()
1013  );
1014 
1015  if ($has_manage_members_permission) {
1016  $tabs->addTab(
1017  'members',
1018  $member_tab_name,
1019  $this->ctrl->getLinkTarget($this, '')
1020  );
1021  } elseif (
1022  (bool) $this->getParentObject()->getShowMembers() && $a_is_participant
1023  ) {
1024  $tabs->addTab(
1025  'members',
1026  $member_tab_name,
1027  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilusersgallerygui'), 'view')
1028  );
1029  } elseif (
1030  $this->getParentObject()->getMailToMembersType() == 1 &&
1031  $GLOBALS['DIC']['rbacsystem']->checkAccess('internal_mail', $mail->getMailObjectReferenceId()) &&
1032  $a_is_participant
1033  ) {
1034  $tabs->addTab(
1035  'members',
1036  $member_tab_name,
1037  $this->ctrl->getLinkTarget($this, "mailMembersBtn")
1038  );
1039  }
1040  }
1041 
1046  protected function getMemberTabName()
1047  {
1048  return $this->lng->txt('members');
1049  }
1050 
1054  protected function setSubTabs(ilTabsGUI $tabs)
1055  {
1056  global $DIC;
1057 
1058  $ilAccess = $DIC['ilAccess'];
1059 
1060  if ($this->checkRbacOrPositionAccessBool('manage_members', 'manage_members', $this->getParentObject()->getRefId())) {
1061  $tabs->addSubTabTarget(
1062  $this->getParentObject()->getType() . "_member_administration",
1063  $this->ctrl->getLinkTarget($this, 'participants'),
1064  "members",
1065  get_class($this)
1066  );
1067 
1068  // show group overview
1069  if ($this instanceof ilCourseMembershipGUI) {
1070  $tabs->addSubTabTarget(
1071  "crs_members_groups",
1072  $this->ctrl->getLinkTargetByClass("ilCourseParticipantsGroupsGUI", "show"),
1073  "",
1074  "ilCourseParticipantsGroupsGUI"
1075  );
1076  }
1077 
1078  $tree = $DIC->repositoryTree();
1079  $children = (array) $tree->getSubTree($tree->getNodeData($this->getParentObject()->getRefId()), false, 'sess');
1080  if (count($children)) {
1081  $tabs->addSubTabTarget(
1082  'events',
1083  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilsessionoverviewgui'), 'listSessions'),
1084  '',
1085  'ilsessionoverviewgui'
1086  );
1087  }
1088 
1089  $tabs->addSubTabTarget(
1090  $this->getParentObject()->getType() . '_members_gallery',
1091  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1092  'view',
1093  'ilUsersGalleryGUI'
1094  );
1095  } elseif ($this->getParentObject()->getShowMembers()) {
1096  // gallery
1097  $tabs->addSubTabTarget(
1098  $this->getParentObject()->getType() . '_members_gallery',
1099  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1100  'view',
1101  'ilUsersGalleryGUI'
1102  );
1103  }
1104 
1105  include_once './Services/Maps/classes/class.ilMapUtil.php';
1106  if (ilMapUtil::isActivated() && $this->getParentObject()->getEnableMap()) {
1107  $tabs->addSubTabTarget(
1108  $this->getParentObject()->getType() . '_members_map',
1109  $this->ctrl->getLinkTarget($this, 'membersMap'),
1110  "membersMap",
1111  get_class($this)
1112  );
1113  }
1114 
1115  include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
1116  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->getRefId())) {
1117  $tabs->addSubTabTarget(
1118  'export_members',
1119  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilmemberexportgui'), 'show'),
1120  '',
1121  'ilmemberexportgui'
1122  );
1123  }
1124  }
1125 
1131  public function readMemberData(array $usr_ids, array $columns)
1132  {
1133  return $this->getParentGUI()->readMemberData($usr_ids, $columns);
1134  }
1135 
1140  public function getLocalRoles()
1141  {
1142  return $this->getParentGUI()->getLocalRoles();
1143  }
1144 
1148  protected function parseSubscriberTable()
1149  {
1150  $subscribers = $this->getMembersObject()->getSubscribers();
1151  $filtered_subscribers = $this->filterUserIdsByRbacOrPositionOfCurrentUser($subscribers);
1152  if (!count($filtered_subscribers)) {
1153  return null;
1154  }
1155  $subscriber = $this->initSubscriberTable();
1156  $subscriber->readSubscriberData(
1157  $filtered_subscribers
1158  );
1159  return $subscriber;
1160  }
1161 
1165  protected function initSubscriberTable()
1166  {
1167  $subscriber = new \ilSubscriberTableGUI($this, $this->getParentObject(), true, true);
1168  $subscriber->setTitle($this->lng->txt('group_new_registrations'));
1169  return $subscriber;
1170  }
1171 
1176  public function confirmAssignSubscribers()
1177  {
1178  if (!is_array($_POST["subscribers"])) {
1179  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1180  $this->ctrl->redirect($this, 'participants');
1181  }
1182 
1183  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1184  $c_gui = new ilConfirmationGUI();
1185 
1186  // set confirm/cancel commands
1187  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
1188  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1189  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1190  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
1191 
1192  foreach ($_POST["subscribers"] as $subscribers) {
1193  $name = ilObjUser::_lookupName($subscribers);
1194 
1195  $c_gui->addItem(
1196  'subscribers[]',
1197  $name['user_id'],
1198  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1199  ilUtil::getImagePath('icon_usr.svg')
1200  );
1201  }
1202 
1203  $this->tpl->setContent($c_gui->getHTML());
1204  return true;
1205  }
1206 
1211  public function confirmRefuseSubscribers()
1212  {
1213  if (!is_array($_POST["subscribers"])) {
1214  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1215  $this->ctrl->redirect($this, 'participants');
1216  }
1217 
1218  $this->lng->loadLanguageModule('mmbr');
1219 
1220  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1221  $c_gui = new ilConfirmationGUI();
1222 
1223  // set confirm/cancel commands
1224  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
1225  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1226  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1227  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
1228 
1229  foreach ($_POST["subscribers"] as $subscribers) {
1230  $name = ilObjUser::_lookupName($subscribers);
1231 
1232  $c_gui->addItem(
1233  'subscribers[]',
1234  $name['user_id'],
1235  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1236  ilUtil::getImagePath('icon_usr.svg')
1237  );
1238  }
1239 
1240  $this->tpl->setContent($c_gui->getHTML());
1241  return true;
1242  }
1243 
1249  protected function refuseSubscribers()
1250  {
1251  global $DIC;
1252 
1253  $rbacsystem = $DIC['rbacsystem'];
1254 
1255  if (!$_POST['subscribers']) {
1256  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1257  $this->ctrl->redirect($this, 'participants');
1258  }
1259 
1260  if (!$this->getMembersObject()->deleteSubscribers($_POST["subscribers"])) {
1261  ilUtil::sendFailure($GLOBALS['DIC']['ilErr']->getMessage(), true);
1262  $this->ctrl->redirect($this, 'participants');
1263  } else {
1264  foreach ($_POST['subscribers'] as $usr_id) {
1265  if ($this instanceof ilCourseMembershipGUI) {
1266  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $usr_id);
1267  }
1268  if ($this instanceof ilGroupMembershipGUI) {
1269  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1270  $this->getMembersObject()->sendNotification(
1272  $usr_id
1273  );
1274  }
1275  if ($this instanceof ilSessionMembershipGUI) {
1277  $noti->setRefId($this->getParentObject()->getRefId());
1278  $noti->setRecipients(array($usr_id));
1280  $noti->send();
1281  }
1282  if ($this instanceof ilLearningSequenceMembershipGUI) {
1283  $this->getMembersObject()->sendNotification(
1285  $usr_id
1286  );
1287  }
1288  }
1289  }
1290 
1291  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_deleted"), true);
1292  $this->ctrl->redirect($this, 'participants');
1293  }
1294 
1301  public function assignSubscribers()
1302  {
1303  global $DIC;
1304 
1305  $ilErr = $DIC['ilErr'];
1306 
1307  if (!is_array($_POST["subscribers"])) {
1308  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1309  $this->ctrl->redirect($this, 'participants');
1310  }
1311 
1312  if (!$this->getMembersObject()->assignSubscribers($_POST["subscribers"])) {
1313  ilUtil::sendFailure($ilErr->getMessage(), true);
1314  $this->ctrl->redirect($this, 'participants');
1315  } else {
1316  foreach ($_POST["subscribers"] as $usr_id) {
1317  if ($this instanceof ilCourseMembershipGUI) {
1318  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_SUBSCRIBER, $usr_id);
1319  $this->getParentObject()->checkLPStatusSync($usr_id);
1320  }
1321  if ($this instanceof ilGroupMembershipGUI) {
1322  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1323  $this->getMembersObject()->sendNotification(
1325  $usr_id
1326  );
1327  }
1328  if ($this instanceof ilSessionMembershipGUI) {
1329  // todo refactor to participants
1330  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1332  $noti->setRefId($this->getParentObject()->getRefId());
1333  $noti->setRecipients(array($usr_id));
1335  $noti->send();
1336  }
1337  }
1338  }
1339  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_assigned"), true);
1340  $this->ctrl->redirect($this, 'participants');
1341  }
1342 
1347  protected function parseWaitingListTable()
1348  {
1349  $wait = $this->initWaitingList();
1350 
1351  $wait_users = $this->filterUserIdsByRbacOrPositionOfCurrentUser($wait->getUserIds());
1352  if (!count($wait_users)) {
1353  return null;
1354  }
1355 
1356  include_once './Services/Membership/classes/class.ilWaitingListTableGUI.php';
1357  $waiting_table = new ilWaitingListTableGUI($this, $this->getParentObject(), $wait);
1358  $waiting_table->setUserIds(
1359  $wait_users
1360  );
1361  $waiting_table->readUserData();
1362  $waiting_table->setTitle($this->lng->txt('crs_waiting_list'));
1363 
1364  return $waiting_table;
1365  }
1366 
1372  {
1373  if (!is_array($_POST["waiting"])) {
1374  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1375  $this->ctrl->redirect($this, 'participants');
1376  }
1377 
1378 
1379  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1380  $c_gui = new ilConfirmationGUI();
1381 
1382  // set confirm/cancel commands
1383  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
1384  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1385  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1386  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
1387 
1388  foreach ($_POST["waiting"] as $waiting) {
1389  $name = ilObjUser::_lookupName($waiting);
1390 
1391  $c_gui->addItem(
1392  'waiting[]',
1393  $name['user_id'],
1394  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1395  ilUtil::getImagePath('icon_usr.svg')
1396  );
1397  }
1398 
1399  $this->tpl->setContent($c_gui->getHTML());
1400  return true;
1401  }
1402 
1408  public function assignFromWaitingList()
1409  {
1410  if (!array_key_exists('waiting', $_POST) || !count($_POST["waiting"])) {
1411  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1412  $this->ctrl->redirect($this, 'participants');
1413  }
1414 
1415  $waiting_list = $this->initWaitingList();
1416 
1417  $added_users = 0;
1418  foreach ($_POST["waiting"] as $user_id) {
1419  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
1420  continue;
1421  }
1422  if ($this->getMembersObject()->isAssigned($user_id)) {
1423  continue;
1424  }
1425 
1426  if ($this instanceof ilCourseMembershipGUI) {
1427  $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
1428  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
1429  $this->getParentObject()->checkLPStatusSync($user_id);
1430  }
1431  if ($this instanceof ilGroupMembershipGUI) {
1432  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1433  $this->getMembersObject()->add($user_id, IL_GRP_MEMBER);
1434  $this->getMembersObject()->sendNotification(
1436  $user_id,
1437  true
1438  );
1439  }
1440  if ($this instanceof ilSessionMembershipGUI) {
1441  $this->getMembersObject()->register($user_id);
1443  $noti->setRefId($this->getParentObject()->getRefId());
1444  $noti->setRecipients(array($user_id));
1446  $noti->send();
1447  }
1448 
1449  $waiting_list->removeFromList($user_id);
1450  ++$added_users;
1451  }
1452 
1453  if ($added_users) {
1454  ilUtil::sendSuccess($this->lng->txt("crs_users_added"), true);
1455  $this->ctrl->redirect($this, 'participants');
1456  } else {
1457  ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"), true);
1458  $this->ctrl->redirect($this, 'participants');
1459  }
1460  }
1461 
1466  public function confirmRefuseFromList()
1467  {
1468  if (!is_array($_POST["waiting"])) {
1469  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1470  $this->ctrl->redirect($this, 'participants');
1471  }
1472 
1473  $this->lng->loadLanguageModule('mmbr');
1474 
1475  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1476  $c_gui = new ilConfirmationGUI();
1477 
1478  // set confirm/cancel commands
1479  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
1480  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1481  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1482  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
1483 
1484  foreach ($_POST["waiting"] as $waiting) {
1485  $name = ilObjUser::_lookupName($waiting);
1486 
1487  $c_gui->addItem(
1488  'waiting[]',
1489  $name['user_id'],
1490  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1491  ilUtil::getImagePath('icon_usr.svg')
1492  );
1493  }
1494 
1495  $this->tpl->setContent($c_gui->getHTML());
1496  return true;
1497  }
1498 
1505  protected function refuseFromList()
1506  {
1507  if (!array_key_exists('waiting', $_POST) || !count($_POST['waiting'])) {
1508  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
1509  $this->ctrl->redirect($this, 'participants');
1510  }
1511 
1512  $waiting_list = $this->initWaitingList();
1513 
1514  foreach ($_POST["waiting"] as $user_id) {
1515  $waiting_list->removeFromList($user_id);
1516 
1517  if ($this instanceof ilCourseMembershipGUI) {
1518  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $user_id, true);
1519  }
1520  if ($this instanceof ilGroupMembershipGUI) {
1521  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1522  $this->getMembersObject()->sendNotification(
1524  $user_id,
1525  true
1526  );
1527  }
1528  if ($this instanceof ilSessionMembershipGUI) {
1529  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1531  $noti->setRefId($this->getParentObject()->getRefId());
1532  $noti->setRecipients(array($user_id));
1534  $noti->send();
1535  }
1536  }
1537  ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'), true);
1538  $this->ctrl->redirect($this, 'participants');
1539  }
1540 
1544  protected function addToClipboard()
1545  {
1546  $users = (array) $_POST['participants'];
1547  if (!count($users)) {
1548  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1549  $this->ctrl->redirect($this, 'participants');
1550  }
1551  include_once './Services/User/classes/class.ilUserClipboard.php';
1552  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
1553  $clip->add($users);
1554  $clip->save();
1555 
1556  $this->lng->loadLanguageModule('user');
1557  ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
1558  $this->ctrl->redirect($this, 'participants');
1559  }
1560 
1564  protected function getDefaultRole()
1565  {
1566  return null;
1567  }
1568 
1572  protected function activateSubTab($a_sub_tab)
1573  {
1577  $tabs = $GLOBALS['DIC']['ilTabs'];
1578  $tabs->activateSubTab($a_sub_tab);
1579  }
1580 
1581 
1582 
1583 
1588  protected function printMembers()
1589  {
1590  global $DIC;
1591 
1592  $ilTabs = $DIC['ilTabs'];
1593 
1594  $this->checkPermission('read');
1595 
1596  $ilTabs->clearTargets();
1597 
1598  $ilTabs->setBackTarget(
1599  $this->lng->txt('back'),
1600  $this->ctrl->getLinkTarget($this, 'participants')
1601  );
1602 
1603  $list = $this->initAttendanceList();
1604  $form = $list->initForm('printMembersOutput');
1605  $this->tpl->setContent($form->getHTML());
1606  }
1607 
1611  protected function printMembersOutput()
1612  {
1613  $list = $this->initAttendanceList();
1614  $list->initFromForm();
1615  $list->setCallback(array($this, 'getAttendanceListUserData'));
1616  $this->member_data = $this->getPrintMemberData(
1618  $this->getMembersObject()->getParticipants()
1619  )
1620  );
1621 
1622  $list->getNonMemberUserData($this->member_data);
1623 
1624  $list->getFullscreenHTML();
1625  exit();
1626  }
1627 
1631  protected function printForMembersOutput()
1632  {
1633  $list = $this->initAttendanceList();
1634  $list->setTitle($this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle());
1635  $list->setId(0);
1636  $form = $list->initForm('printForMembersOutput');
1637  $list->initFromForm();
1638  $list->setCallback(array($this, 'getAttendanceListUserData'));
1639  $this->member_data = $this->getPrintMemberData($this->getMembersObject()->getParticipants());
1640  $list->getNonMemberUserData($this->member_data);
1641 
1642  $list->getFullscreenHTML();
1643  exit();
1644  }
1645 
1649  protected function jump2UsersGallery()
1650  {
1651  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
1652  }
1653 
1654 
1655 
1656 
1660  protected function initAttendanceList($a_for_members = false)
1661  {
1662  global $DIC;
1663 
1667  $waiting_list = $this->initWaitingList();
1668 
1669  if ($this instanceof ilSessionMembershipGUI) {
1670  $member_id = $DIC->repositoryTree()->checkForParentType(
1671  $this->getParentObject()->getRefId(),
1672  'grp'
1673  );
1674  if (!$member_id) {
1675  $member_id = $DIC->repositoryTree()->checkForParentType(
1676  $this->getParentObject()->getRefId(),
1677  'crs'
1678  );
1679  }
1680  if (!$member_id) {
1681  $DIC->logger()->sess()->warning('Cannot find parent course or group for ref_id: ' . $this->getParentObject()->getRefId());
1682  $member_id = $this->getParentObject()->getRefId();
1683  }
1684  $part = ilParticipants::getInstance($member_id);
1685 
1686  $list = new ilAttendanceList(
1687  $this,
1688  $this->getParentObject(),
1689  $part,
1690  $waiting_list
1691  );
1692  } else {
1693  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1694  $list = new ilAttendanceList(
1695  $this,
1696  $this->getParentObject(),
1697  $this->getMembersObject(),
1698  $waiting_list
1699  );
1700  }
1701  $list->setId($this->getParentObject()->getType() . '_memlist_' . $this->getParentObject()->getId());
1702 
1703  $list->setTitle(
1704  $this->lng->txt($this->getParentObject()->getType() . '_members_print_title'),
1705  $this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle()
1706  );
1707 
1708  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
1709  $show_tracking =
1711  if ($show_tracking) {
1712  include_once('./Services/Object/classes/class.ilObjectLP.php');
1713  $olp = ilObjectLP::getInstance($this->getParentObject()->getId());
1714  $show_tracking = $olp->isActive();
1715  }
1716  if ($show_tracking) {
1717  $list->addPreset('progress', $this->lng->txt('learning_progress'), true);
1718  }
1719 
1720  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1724  $privacy = ilPrivacySettings::_getInstance();
1725  if ($privacy->enabledAccessTimesByType($this->getParentObject()->getType())) {
1726  $list->addPreset('access', $this->lng->txt('last_access'), true);
1727  }
1728 
1729  switch ($this->getParentObject()->getType()) {
1730  case 'crs':
1731  $list->addPreset('status', $this->lng->txt('crs_status'), true);
1732  $list->addPreset('passed', $this->lng->txt('crs_passed'), true);
1733  break;
1734 
1735  case 'sess':
1736  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1737  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1738  if ($this->getParentObject()->enabledRegistration()) {
1739  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1740  }
1741  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1742  $list->addBlank($this->lng->txt('sess_signature'));
1743 
1744  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1745  break;
1746 
1747  case 'grp':
1748  default:
1749  break;
1750  }
1751 
1752  return $list;
1753  }
1754 }
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.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
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.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
getMailContextOptions()
Get mail context options.
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.
$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.
$a_type
Definition: workflow.php:92
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.
if(isset($_POST['submit'])) $form
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
GUI class for course/group subscriptions.
$ilUser
Definition: imgupload.php:18
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.
$users
Definition: authpage.php:44
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.
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
confirmRefuseSubscribers()
Refuse subscriber confirmation.
static isActivated()
Checks whether Map feature is activated.
exit
Definition: backend.php:16
parseSubscriberTable()
Parse table of subscription request.
mailMembersBtn()
Mail to members view type $ilToolbar.
getDefaultCommand()
Get default command.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
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
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
static setRecipients(array $recipients)
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.
if(empty($password)) $table
Definition: pwgen.php:24
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
participantsApplyFilter()
Apply filter for participant table.
Confirmation screen class.