ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->repository_gui = $repository_gui;
56  $this->repository_object = $repository_obj;
57 
58  $this->lng = $GLOBALS['DIC']->language();
59  $this->lng->loadLanguageModule('crs');
60  $this->lng->loadLanguageModule($this->getParentObject()->getType());
61  $this->tpl = $GLOBALS['DIC']->ui()->mainTemplate();
62  $this->ctrl = $GLOBALS['DIC']->ctrl();
63  $this->logger = ilLoggerFactory::getLogger($this->getParentObject()->getType());
64  $this->access = $GLOBALS['DIC']->access();
65  }
66 
70  protected function getLanguage()
71  {
72  return $this->lng;
73  }
74 
78  protected function getCtrl()
79  {
80  return $this->ctrl;
81  }
82 
86  protected function getLogger()
87  {
88  return $this->logger;
89  }
90 
91 
96  public function getParentGUI()
97  {
98  return $this->repository_gui;
99  }
100 
105  public function getParentObject()
106  {
108  }
109 
114  public function getMembersObject()
115  {
116  if ($this->participants instanceof ilParticipants) {
117  return $this->participants;
118  }
119  include_once './Services/Membership/classes/class.ilParticipants.php';
120  return $this->participants = ilParticipants::getInstanceByObjId($this->getParentObject()->getId());
121  }
122 
130  protected function checkPermissionBool($a_permission, $a_cmd = '', $a_type = '', $a_ref_id = 0)
131  {
132  if (!$a_ref_id) {
133  $a_ref_id = $this->getParentObject()->getRefId();
134  }
135  return $this->access->checkAccess($a_permission, $a_cmd, $a_ref_id);
136  }
137 
144  protected function checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id = 0)
145  {
146  if (!$a_ref_id) {
147  $a_ref_id = $this->getParentObject()->getRefId();
148  }
149  return $this->access->checkRbacOrPositionPermissionAccess($a_rbac_perm, $a_pos_perm, $a_ref_id);
150  }
151 
159  protected function checkPermission($a_permission, $a_cmd = "")
160  {
161  if (!$this->checkPermissionBool($a_permission, $a_cmd)) {
162  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
163  $this->ctrl->redirect($this->getParentGUI());
164  }
165  }
166 
173  protected function checkRbacOrPermissionAccess($a_rbac_perm, $a_pos_perm)
174  {
175  if (!$this->checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm)) {
176  ilUtil::sendFailure($this->lng->txt('no_permission'), true);
177  $this->ctrl->redirect($this->getParentGUI());
178  }
179  }
180 
181 
182 
187  protected function canAddOrSearchUsers()
188  {
189  return $this->checkPermissionBool('manage_members');
190  }
191 
192 
198  public function filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
199  {
200  return $a_user_ids;
201  }
202 
206  public function executeCommand()
207  {
211  global $ilUser, $ilErr, $ilAccess, $rbacsystem, $ilTabs;
212 
213  $cmd = $this->ctrl->getCmd('participants');
214  $next_class = $this->ctrl->getNextClass();
215 
216  switch ($next_class) {
217  case 'ilrepositorysearchgui':
218 
219  $this->checkPermission('manage_members');
220 
221  include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
222  include_once './Services/Membership/classes/class.ilParticipants.php';
223  $rep_search = new ilRepositorySearchGUI();
224  $rep_search->addUserAccessFilterCallable([$this,'filterUserIdsByRbacOrPositionOfCurrentUser']);
225 
226  $participants = $this->getMembersObject();
227  if (
228  $participants->isAdmin($GLOBALS['ilUser']->getId()) ||
229  $ilAccess->checkAccess('manage_members', '', $this->getParentObject()->getRefId())
230  ) {
231  $rep_search->setCallback(
232  $this,
233  'assignMembers',
234  $this->getParentGUI()->getLocalRoles()
235  );
236  } else {
237  //#18445 excludes admin role
238  $rep_search->setCallback(
239  $this,
240  'assignMembers',
241  $this->getLocalRoles(array($this->getParentObject()->getDefaultAdminRole()))
242  );
243  }
244 
245  // Set tabs
246  $this->ctrl->setReturn($this, 'participants');
247  $ret = $this->ctrl->forwardCommand($rep_search);
248  break;
249 
250 
251  case 'ilmailmembersearchgui':
252 
253  $ilTabs->clearTargets();
254  $ilTabs->setBackTarget(
255  $this->lng->txt('btn_back'),
256  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
257  );
258 
259  include_once 'Services/Mail/classes/class.ilMail.php';
260  $mail = new ilMail($ilUser->getId());
261  include_once 'Modules/Course/classes/class.ilCourseConstants.php';
262  if (
263  !(
264  $this->getParentObject()->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
265  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId())
266  ) || !$rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())
267  ) {
268  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
269  }
270 
271  include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
272  include_once './Services/Contact/classes/class.ilMailMemberCourseRoles.php';
273 
274 
275  switch ($this->getParentObject()->getType()) {
276  case 'grp':
277  $objroles = new ilMailMemberGroupRoles();
278  break;
279 
280  default:
281  $objroles = new ilMailMemberCourseRoles();
282  break;
283  }
284 
285  // @todo: fix mail course roles object
286  $mail_search = new ilMailMemberSearchGUI($this, $this->getParentObject()->getRefId(), $objroles);
287  $mail_search->setObjParticipants(
289  );
290  $this->ctrl->forwardCommand($mail_search);
291  break;
292 
293  case 'ilusersgallerygui':
294 
295  $this->setSubTabs($GLOBALS['ilTabs']);
296  $tabs = $GLOBALS['DIC']->tabs()->setSubTabActive(
297  $this->getParentObject()->getType() . '_members_gallery'
298  );
299 
300  $is_admin = (bool) $this->checkRbacOrPositionAccessBool('manage_members', 'manage_members');
301  $is_participant = (bool) ilParticipants::_isParticipant($this->getParentObject()->getRefId(), $ilUser->getId());
302  if (
303  !$is_admin &&
304  (
305  $this->getParentObject()->getShowMembers() == 0 ||
306  !$is_participant
307  )
308  ) {
309  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
310  }
311 
312  $this->showMailToMemberToolbarButton($GLOBALS['ilToolbar'], 'jump2UsersGallery');
313  $this->showMemberExportToolbarButton($GLOBALS['ilToolbar'], 'jump2UsersGallery');
314 
315  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryGUI.php';
316  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryParticipants.php';
317 
318 
320  $gallery_gui = new ilUsersGalleryGUI($provider);
321  $this->ctrl->forwardCommand($gallery_gui);
322  break;
323 
324  case 'ilcourseparticipantsgroupsgui':
325 
326  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
327  $this->setSubTabs($GLOBALS['ilTabs']);
328 
329 
330  include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
331  $cmg_gui = new ilCourseParticipantsGroupsGUI($this->getParentObject()->getRefId());
332  if ($cmd == "show" || $cmd = "") {
333  $this->showMailToMemberToolbarButton($GLOBALS['ilToolbar']);
334  }
335  $this->ctrl->forwardCommand($cmg_gui);
336  break;
337 
338  case 'ilsessionoverviewgui':
339 
340  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
341  $this->setSubTabs($GLOBALS['ilTabs']);
342 
343  include_once './Services/Membership/classes/class.ilParticipants.php';
344  $prt = ilParticipants::getInstance($this->getParentObject()->getRefId());
345 
346  include_once('./Modules/Session/classes/class.ilSessionOverviewGUI.php');
347  $overview = new ilSessionOverviewGUI($this->getParentObject()->getRefId(), $prt);
348  $this->ctrl->forwardCommand($overview);
349  break;
350 
351  case 'ilmemberexportgui':
352 
353  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
354  $this->setSubTabs($GLOBALS['ilTabs']);
355 
356  include_once('./Services/Membership/classes/Export/class.ilMemberExportGUI.php');
357  $export = new ilMemberExportGUI($this->getParentObject()->getRefId());
358  $this->ctrl->forwardCommand($export);
359  break;
360 
361  case 'ilobjectcustomuserfieldsgui':
362 
363  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
364  $this->setSubTabs($GLOBALS['ilTabs']);
365  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
366  $this->ctrl->setReturn($this, 'participants');
367 
368  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
369  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->getParentGUI()->object->getId());
370  $this->ctrl->forwardCommand($cdf_gui);
371  break;
372 
373  default:
374 
375  $this->setSubTabs($GLOBALS['DIC']['ilTabs']);
376 
377  //exclude mailMembersBtn cmd from this check
378  if (
379  $cmd == "mailMembersBtn" ||
380  $cmd == 'membersMap' ||
381  $cmd == 'printForMembersOutput' ||
382  $cmd == 'jump2UsersGallery'
383  ) {
384  $this->checkPermission('read');
385  } else {
386  $this->checkRbacOrPermissionAccess('manage_members', 'manage_members');
387  }
388 
389  $this->$cmd();
390  break;
391  }
392  }
393 
397  protected function participants()
398  {
399  $this->initParticipantTemplate();
400  $this->showParticipantsToolbar();
401  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
402 
403  // show waiting list table
404  $waiting = $this->parseWaitingListTable();
405  if ($waiting instanceof ilWaitingListTableGUI) {
406  $this->tpl->setVariable('TABLE_WAIT', $waiting->getHTML());
407  }
408 
409  // show subscriber table
410  $subscriber = $this->parseSubscriberTable();
411  if ($subscriber instanceof ilSubscriberTableGUI) {
412  $this->tpl->setVariable('TABLE_SUB', $subscriber->getHTML());
413  }
414 
415  // show member table
416  $table = $this->initParticipantTableGUI();
417  $table->setTitle($this->lng->txt($this->getParentObject()->getType() . '_mem_tbl_header'));
418  $table->setFormAction($this->ctrl->getFormAction($this));
419  $table->parse();
420 
421  // filter commands
422  $table->setFilterCommand('participantsApplyFilter');
423  $table->setResetCommand('participantsResetFilter');
424 
425  $this->tpl->setVariable('MEMBERS', $table->getHTML());
426  }
427 
431  protected function participantsApplyFilter()
432  {
433  $table = $this->initParticipantTableGUI();
434  $table->resetOffset();
435  $table->writeFilterToSession();
436 
437  $this->participants();
438  }
439 
443  protected function participantsResetFilter()
444  {
445  ilLoggerFactory::getLogger('root')->dump($_POST);
446 
447  $table = $this->initParticipantTableGUI();
448  $table->resetOffset();
449  $table->resetFilter();
450 
451  $this->participants();
452  }
453 
454 
458  protected function editMember()
459  {
460  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
461  return $this->editParticipants(array($_REQUEST['member_id']));
462  }
463 
468  protected function editParticipants($post_participants = array())
469  {
470  if (!$post_participants) {
471  $post_participants = (array) $_POST['participants'];
472  }
473 
474  $real_participants = $this->getMembersObject()->getParticipants();
475  $participants = array_intersect((array) $post_participants, (array) $real_participants);
476 
477  if (!count($participants)) {
478  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
479  $this->ctrl->redirect($this, 'participants');
480  }
481  $table = $this->initEditParticipantTableGUI($participants);
482  $this->tpl->setContent($table->getHTML());
483  return true;
484  }
485 
493  public function updateParticipants()
494  {
495  global $rbacsystem, $rbacreview, $ilUser, $ilAccess;
496 
497  if (!count($_POST['participants'])) {
498  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
499  $this->ctrl->redirect($this, 'participants');
500  }
501 
502  $notifications = $_POST['notification'] ? $_POST['notification'] : array();
503  $passed = $_POST['passed'] ? $_POST['passed'] : array();
504  $blocked = $_POST['blocked'] ? $_POST['blocked'] : array();
505  $contact = $_POST['contact'] ? $_POST['contact'] : array();
506 
507  // Determine whether the user has the 'edit_permission' permission
508  $hasEditPermissionAccess =
509  (
510  $ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) or
511  $this->getMembersObject()->isAdmin($ilUser->getId())
512  );
513 
514  // Get all assignable local roles of the object, and
515  // determine the role id of the course administrator role.
516  $assignableLocalRoles = array();
517  $adminRoleId = $this->getParentObject()->getDefaultAdminRole();
518  foreach ($this->getLocalTypeRole(false) as $title => $role_id) {
519  $assignableLocalRoles[$role_id] = $title;
520  }
521 
522  // Validate the user ids and role ids in the post data
523  foreach ($_POST['participants'] as $usr_id) {
524  $memberIsAdmin = $rbacreview->isAssigned($usr_id, $adminRoleId);
525 
526  // If the current user doesn't have the 'edit_permission'
527  // permission, make sure he doesn't remove the course
528  // administrator role of members who are course administrator.
529  if (!$hasEditPermissionAccess && $memberIsAdmin &&
530  !in_array($adminRoleId, $_POST['roles'][$usr_id])
531  ) {
532  $_POST['roles'][$usr_id][] = $adminRoleId;
533  }
534 
535  // Validate the role ids in the post data
536  foreach ((array) $_POST['roles'][$usr_id] as $role_id) {
537  if (!array_key_exists($role_id, $assignableLocalRoles)) {
538  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
539  $this->ctrl->redirect($this, 'participants');
540  }
541  if (!$hasEditPermissionAccess &&
542  $role_id == $adminRoleId &&
543  !$memberIsAdmin) {
544  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'));
545  $this->ctrl->redirect($this, 'participants');
546  }
547  }
548  }
549 
550  $has_admin = false;
551  foreach ($this->getMembersObject()->getAdmins() as $admin_id) {
552  if (!isset($_POST['roles'][$admin_id])) {
553  $has_admin = true;
554  break;
555  }
556  if (in_array($adminRoleId, $_POST['roles'][$admin_id])) {
557  $has_admin = true;
558  break;
559  }
560  }
561 
562  if (!$has_admin) {
563  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_min_one_admin'), true);
564  $this->ctrl->redirect($this, 'participants');
565  }
566 
567  foreach ($_POST['participants'] as $usr_id) {
568  $this->getMembersObject()->updateRoleAssignments($usr_id, (array) $_POST['roles'][$usr_id]);
569 
570  // Disable notification for all of them
571  $this->getMembersObject()->updateNotification($usr_id, 0);
572  if (($this->getMembersObject()->isTutor($usr_id) or $this->getMembersObject()->isAdmin($usr_id)) and in_array($usr_id, $notifications)) {
573  $this->getMembersObject()->updateNotification($usr_id, 1);
574  }
575 
576  $this->getMembersObject()->updateBlocked($usr_id, 0);
577  if ((!$this->getMembersObject()->isAdmin($usr_id) and !$this->getMembersObject()->isTutor($usr_id)) and in_array($usr_id, $blocked)) {
578  $this->getMembersObject()->updateBlocked($usr_id, 1);
579  }
580 
581  if ($this instanceof ilCourseMembershipGUI) {
582  $this->getMembersObject()->updatePassed($usr_id, in_array($usr_id, $passed), true);
583  $this->getMembersObject()->sendNotification(
584  $this->getMembersObject()->NOTIFY_STATUS_CHANGED,
585  $usr_id
586  );
587  }
588 
589  if (
590  ($this->getMembersObject()->isAdmin($usr_id) ||
591  $this->getMembersObject()->isTutor($usr_id)) &&
592  in_array($usr_id, $contact)
593  ) {
594  $this->getMembersObject()->updateContact($usr_id, true);
595  } else {
596  $this->getMembersObject()->updateContact($usr_id, false);
597  }
598 
599  $this->updateLPFromStatus($usr_id, in_array($usr_id, $passed));
600  }
601  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
602  $this->ctrl->redirect($this, "participants");
603  }
604 
608  protected function confirmDeleteParticipants()
609  {
610  global $ilAccess, $ilUser;
611 
612  $participants = (array) $_POST['participants'];
613 
614  if (!count($participants)) {
615  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
616  $this->ctrl->redirect($this, 'participants');
617  }
618 
619  // Check last admin
620  if (!$this->getMembersObject()->checkLastAdmin($participants)) {
621  ilUtil::sendFailure($this->lng->txt($this->getParentObject()->getType() . '_at_least_one_admin'), true);
622  $this->ctrl->redirect($this, 'participants');
623  }
624 
625  // if only position access is granted, show additional info
626  if (!$this->checkPermissionBool('manage_members')) {
627  $this->lng->loadLanguageModule('rbac');
628  ilUtil::sendInfo($this->lng->txt('rbac_info_only_position_access'));
629  }
630 
631 
632  // Access check for admin deletion
633  if (
634  !$ilAccess->checkAccess(
635  'edit_permission',
636  '',
637  $this->getParentObject()->getRefId()
638  ) &&
639  !$this->getMembersObject()->isAdmin($GLOBALS['ilUser']->getId())
640  ) {
641  foreach ($participants as $usr_id) {
642  if ($this->getMembersObject()->isAdmin($usr_id)) {
643  ilUtil::sendFailure($this->lng->txt("msg_no_perm_perm"), true);
644  $this->ctrl->redirect($this, 'participants');
645  }
646  }
647  }
648 
649 
650  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
651  $confirm = new ilConfirmationGUI();
652  $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
653  $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
654  $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
655  $confirm->setCancel($this->lng->txt('cancel'), 'participants');
656 
657  foreach ($participants as $usr_id) {
658  $name = ilObjUser::_lookupName($usr_id);
659 
660  $confirm->addItem(
661  'participants[]',
662  $name['user_id'],
663  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
664  ilUtil::getImagePath('icon_usr.svg')
665  );
666  }
667 
668  $this->tpl->setContent($confirm->getHTML());
669  }
670 
671  protected function deleteParticipants()
672  {
673  global $rbacreview, $rbacsystem, $ilAccess, $ilUser;
674 
675  $participants = (array) $_POST['participants'];
676 
677  if (!is_array($participants) or !count($participants)) {
678  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
679  $this->ctrl->redirect($this, 'participants');
680  }
681 
682  // If the user doesn't have the edit_permission and is not administrator, he may not remove
683  // members who have the course administrator role
684  if (
685  !$ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) &&
686  !$this->getMembersObject()->isAdmin($GLOBALS['ilUser']->getId())
687  ) {
688  foreach ($participants as $part) {
689  if ($this->getMembersObject()->isAdmin($part)) {
690  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
691  $this->ctrl->redirect($this, 'participants');
692  }
693  }
694  }
695 
696  if (!$this->getMembersObject()->deleteParticipants($participants)) {
697  ilUtil::sendFailure('Error deleting participants.', true);
698  $this->ctrl->redirect($this, 'participants');
699  } else {
700  foreach ((array) $_POST["participants"] as $usr_id) {
701  $mail_type = 0;
702  // @todo more generic
703  switch ($this->getParentObject()->getType()) {
704  case 'crs':
705  $mail_type = $this->getMembersObject()->NOTIFY_DISMISS_MEMBER;
706  break;
707  case 'grp':
708  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
710  break;
711  }
712  $this->getMembersObject()->sendNotification($mail_type, $usr_id);
713  }
714  }
715  ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
716  $this->ctrl->redirect($this, "participants");
717 
718  return true;
719  }
720 
724  protected function sendMailToSelectedUsers()
725  {
726  if ($_POST['participants']) {
727  $participants = (array) $_POST['participants'];
728  } elseif ($_GET['member_id']) {
729  $participants = array($_GET['member_id']);
730  } elseif ($_POST['subscribers']) {
731  $participants = (array) $_POST['subscribers'];
732  } elseif ($_POST['waiting']) {
733  $participants = (array) $_POST['waiting'];
734  }
735 
736  if (!count($participants)) {
737  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
738  $this->ctrl->redirect($this, 'participants');
739  }
740 
741  foreach ($participants as $usr_id) {
742  $rcps[] = ilObjUser::_lookupLogin($usr_id);
743  }
744 
745  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
746  require_once 'Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
747 
748  $context_options = [];
749 
750  // @todo refactor
751  if ($this->getParentObject()->getType() == 'crs') {
752  $context_options =
753  array(
755  'ref_id' => $this->getParentObject()->getRefId(),
756  'ts' => time()
757  );
758  }
759 
760 
764  $this,
765  'participants',
766  array(),
767  array(
768  'type' => 'new',
769  'sig' => $this->createMailSignature()
770  ),
771  $context_options
772  )
773  );
774  }
775 
779  protected function membersMap()
780  {
781  global $tpl;
782  $this->activateSubTab($this->getParentObject()->getType() . "_members_map");
783  include_once("./Services/Maps/classes/class.ilMapUtil.php");
784  if (!ilMapUtil::isActivated() || !$this->getParentObject()->getEnableMap()) {
785  return;
786  }
787 
788  $map = ilMapUtil::getMapGUI();
789  $map->setMapId("course_map")
790  ->setWidth("700px")
791  ->setHeight("500px")
792  ->setLatitude($this->getParentObject()->getLatitude())
793  ->setLongitude($this->getParentObject()->getLongitude())
794  ->setZoom($this->getParentObject()->getLocationZoom())
795  ->setEnableTypeControl(true)
796  ->setEnableNavigationControl(true)
797  ->setEnableCentralMarker(true);
798 
799  include_once './Services/Membership/classes/class.ilParticipants.php';
800  $members = ilParticipants::getInstanceByObjId($this->getParentObject()->getId())->getParticipants();
801  foreach ((array) $members as $user_id) {
802  $map->addUserMarker($user_id);
803  }
804 
805  $tpl->setContent($map->getHTML());
806  $tpl->setLeftContent($map->getUserListHTML());
807  }
808 
813  protected function mailMembersBtn()
814  {
815  global $ilToolbar;
816 
817  $this->showMailToMemberToolbarButton($GLOBALS['ilToolbar'], 'mailMembersBtn');
818  }
819 
820 
821 
822 
826  protected function showParticipantsToolbar()
827  {
828  global $ilToolbar;
829 
830  if ($this->canAddOrSearchUsers()) {
831  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
833  $this,
834  $ilToolbar,
835  array(
836  'auto_complete_name' => $this->lng->txt('user'),
837  'user_type' => $this->getParentGUI()->getLocalRoles(),
838  'user_type_default' => $this->getDefaultRole(),
839  'submit_name' => $this->lng->txt('add')
840  )
841  );
842 
843  // spacer
844  $ilToolbar->addSeparator();
845 
846  // search button
847  $ilToolbar->addButton(
848  $this->lng->txt($this->getParentObject()->getType() . "_search_users"),
849  $this->ctrl->getLinkTargetByClass(
850  'ilRepositorySearchGUI',
851  'start'
852  )
853  );
854 
855  // separator
856  $ilToolbar->addSeparator();
857  }
858 
859  // print button
860  $ilToolbar->addButton(
861  $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
862  $this->ctrl->getLinkTarget($this, 'printMembers')
863  );
864 
865  $this->showMailToMemberToolbarButton($ilToolbar, 'participants', false);
866  }
867 
874  protected function showMemberExportToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
875  {
876  if (
877  $this->getParentObject()->getType() == 'crs' &&
878  $this->getParentObject()->getShowMembersExport()) {
879  if ($a_separator) {
880  $toolbar->addSeparator();
881  }
882 
883  if ($a_back_cmd) {
884  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
885  }
886  $toolbar->addButton(
887  $this->lng->txt($this->getParentObject()->getType() . '_print_list'),
888  $this->ctrl->getLinkTarget($this, 'printForMembersOutput')
889  );
890  }
891  }
892 
893 
894 
895 
896 
900  protected function showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd = null, $a_separator = false)
901  {
902  global $ilUser, $rbacsystem, $ilAccess;
903  include_once 'Services/Mail/classes/class.ilMail.php';
904  $mail = new ilMail($ilUser->getId());
905 
906  if (
907  ($this->getParentObject()->getMailToMembersType() == 1) ||
908  (
909  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId()) &&
910  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())
911  )
912  ) {
913  if ($a_separator) {
914  $toolbar->addSeparator();
915  }
916 
917  if ($a_back_cmd) {
918  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
919  }
920 
921  $toolbar->addButton(
922  $this->lng->txt("mail_members"),
923  $this->ctrl->getLinkTargetByClass('ilMailMemberSearchGUI', '')
924  );
925  }
926  }
927 
932  public function createMailSignature()
933  {
934  return $this->getParentGUI()->createMailSignature();
935  }
936 
941  protected function getDefaultCommand()
942  {
943  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
944  'manage_members',
945  'manage_members',
946  $this->getParentObject()->getRefId()
947  );
948  if ($has_manage_members_permission) {
949  return 'participants';
950  }
951 
952  if ($this->getParentObject()->getShowMembers()) {
953  return 'jump2UsersGallery';
954  }
955  return 'mailMembersBtn';
956  }
957 
958 
963  public function addMemberTab(ilTabsGUI $tabs, $a_is_participant = false)
964  {
965  global $ilAccess;
966 
967  include_once './Services/Mail/classes/class.ilMail.php';
968  $mail = new ilMail($GLOBALS['ilUser']->getId());
969 
970  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
971  'manage_members',
972  'manage_members',
973  $this->getParentObject()->getRefId()
974  );
975 
976  if ($has_manage_members_permission) {
977  $tabs->addTab(
978  'members',
979  $this->lng->txt('members'),
980  $this->ctrl->getLinkTarget($this, '')
981  );
982  } elseif (
983  (bool) $this->getParentObject()->getShowMembers() && $a_is_participant
984  ) {
985  $tabs->addTab(
986  'members',
987  $this->lng->txt('members'),
988  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilusersgallerygui'), 'view')
989  );
990  } elseif (
991  $this->getParentObject()->getMailToMembersType() == 1 &&
992  $GLOBALS['rbacsystem']->checkAccess('internal_mail', $mail->getMailObjectReferenceId()) &&
993  $a_is_participant
994  ) {
995  $tabs->addTab(
996  'members',
997  $this->lng->txt('members'),
998  $this->ctrl->getLinkTarget($this, "mailMembersBtn")
999  );
1000  }
1001  }
1002 
1006  protected function setSubTabs(ilTabsGUI $tabs)
1007  {
1008  global $ilAccess;
1009 
1010  if ($this->checkRbacOrPositionAccessBool('manage_members', 'manage_members', $this->getParentObject()->getRefId())) {
1011  $tabs->addSubTabTarget(
1012  $this->getParentObject()->getType() . "_member_administration",
1013  $this->ctrl->getLinkTarget($this, 'participants'),
1014  "members",
1015  get_class($this)
1016  );
1017 
1018  // show group overview
1019  if ($this instanceof ilCourseMembershipGUI) {
1020  $tabs->addSubTabTarget(
1021  "crs_members_groups",
1022  $this->ctrl->getLinkTargetByClass("ilCourseParticipantsGroupsGUI", "show"),
1023  "",
1024  "ilCourseParticipantsGroupsGUI"
1025  );
1026  }
1027 
1028  $childs = (array) $GLOBALS['tree']->getChildsByType($this->getParentObject()->getRefId(), 'sess');
1029  if (count($childs)) {
1030  $tabs->addSubTabTarget(
1031  'events',
1032  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilsessionoverviewgui'), 'listSessions'),
1033  '',
1034  'ilsessionoverviewgui'
1035  );
1036  }
1037 
1038  $tabs->addSubTabTarget(
1039  $this->getParentObject()->getType() . '_members_gallery',
1040  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1041  'view',
1042  'ilUsersGalleryGUI'
1043  );
1044  } elseif ($this->getParentObject()->getShowMembers()) {
1045  // gallery
1046  $tabs->addSubTabTarget(
1047  $this->getParentObject()->getType() . '_members_gallery',
1048  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1049  'view',
1050  'ilUsersGalleryGUI'
1051  );
1052  }
1053 
1054  include_once './Services/Maps/classes/class.ilMapUtil.php';
1055  if (ilMapUtil::isActivated() && $this->getParentObject()->getEnableMap()) {
1056  $tabs->addSubTabTarget(
1057  $this->getParentObject()->getType() . '_members_map',
1058  $this->ctrl->getLinkTarget($this, 'membersMap'),
1059  "membersMap",
1060  get_class($this)
1061  );
1062  }
1063 
1064  include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
1065  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->getRefId())) {
1066  $tabs->addSubTabTarget(
1067  'export_members',
1068  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilmemberexportgui'), 'show'),
1069  '',
1070  'ilmemberexportgui'
1071  );
1072  }
1073  }
1074 
1080  public function readMemberData(array $usr_ids, array $columns)
1081  {
1082  return $this->getParentGUI()->readMemberData($usr_ids, $columns);
1083  }
1084 
1089  public function getLocalRoles()
1090  {
1091  return $this->getParentGUI()->getLocalRoles();
1092  }
1093 
1097  protected function parseSubscriberTable()
1098  {
1099  $subscribers = $this->getMembersObject()->getSubscribers();
1100  $filtered_subscribers = $this->filterUserIdsByRbacOrPositionOfCurrentUser($subscribers);
1101  if (!count($filtered_subscribers)) {
1102  return null;
1103  }
1104  $subscriber = new ilSubscriberTableGUI($this, $this->getParentObject(), true);
1105  $subscriber->setTitle($this->lng->txt('group_new_registrations'));
1106  $subscriber->readSubscriberData(
1107  $filtered_subscribers
1108  );
1109  return $subscriber;
1110  }
1111 
1116  public function confirmAssignSubscribers()
1117  {
1118  if (!is_array($_POST["subscribers"])) {
1119  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1120  $this->ctrl->redirect($this, 'participants');
1121  }
1122 
1123  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1124  $c_gui = new ilConfirmationGUI();
1125 
1126  // set confirm/cancel commands
1127  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
1128  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1129  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1130  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
1131 
1132  foreach ($_POST["subscribers"] as $subscribers) {
1133  $name = ilObjUser::_lookupName($subscribers);
1134 
1135  $c_gui->addItem(
1136  'subscribers[]',
1137  $name['user_id'],
1138  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1139  ilUtil::getImagePath('icon_usr.svg')
1140  );
1141  }
1142 
1143  $this->tpl->setContent($c_gui->getHTML());
1144  return true;
1145  }
1146 
1151  public function confirmRefuseSubscribers()
1152  {
1153  if (!is_array($_POST["subscribers"])) {
1154  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1155  $this->ctrl->redirect($this, 'participants');
1156  }
1157 
1158  $this->lng->loadLanguageModule('mmbr');
1159 
1160  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1161  $c_gui = new ilConfirmationGUI();
1162 
1163  // set confirm/cancel commands
1164  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
1165  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1166  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1167  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
1168 
1169  foreach ($_POST["subscribers"] as $subscribers) {
1170  $name = ilObjUser::_lookupName($subscribers);
1171 
1172  $c_gui->addItem(
1173  'subscribers[]',
1174  $name['user_id'],
1175  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1176  ilUtil::getImagePath('icon_usr.svg')
1177  );
1178  }
1179 
1180  $this->tpl->setContent($c_gui->getHTML());
1181  return true;
1182  }
1183 
1189  protected function refuseSubscribers()
1190  {
1191  global $rbacsystem;
1192 
1193  if (!$_POST['subscribers']) {
1194  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1195  $this->ctrl->redirect($this, 'participants');
1196  }
1197 
1198  if (!$this->getMembersObject()->deleteSubscribers($_POST["subscribers"])) {
1199  ilUtil::sendFailure($GLOBALS['ilErr']->getMessage(), true);
1200  $this->ctrl->redirect($this, 'participants');
1201  } else {
1202  foreach ($_POST['subscribers'] as $usr_id) {
1203  if ($this instanceof ilCourseMembershipGUI) {
1204  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $usr_id);
1205  }
1206  if ($this instanceof ilGroupMembershipGUI) {
1207  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1208  $this->getMembersObject()->sendNotification(
1210  $usr_id
1211  );
1212  }
1213  if ($this instanceof ilSessionMembershipGUI) {
1215  $noti->setRefId($this->getParentObject()->getRefId());
1216  $noti->setRecipients(array($usr_id));
1218  $noti->send();
1219  }
1220  }
1221  }
1222 
1223  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_deleted"), true);
1224  $this->ctrl->redirect($this, 'participants');
1225  }
1226 
1233  public function assignSubscribers()
1234  {
1235  global $ilErr;
1236 
1237  if (!is_array($_POST["subscribers"])) {
1238  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1239  $this->ctrl->redirect($this, 'participants');
1240  }
1241 
1242  if (!$this->getMembersObject()->assignSubscribers($_POST["subscribers"])) {
1243  ilUtil::sendFailure($ilErr->getMessage(), true);
1244  $this->ctrl->redirect($this, 'participants');
1245  } else {
1246  foreach ($_POST["subscribers"] as $usr_id) {
1247  if ($this instanceof ilCourseMembershipGUI) {
1248  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_SUBSCRIBER, $usr_id);
1249  $this->getParentObject()->checkLPStatusSync($usr_id);
1250  }
1251  if ($this instanceof ilGroupMembershipGUI) {
1252  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1253  $this->getMembersObject()->sendNotification(
1255  $usr_id
1256  );
1257  }
1258  if ($this instanceof ilSessionMembershipGUI) {
1259  // todo refactor to participants
1260  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1262  $noti->setRefId($this->getParentObject()->getRefId());
1263  $noti->setRecipients(array($usr_id));
1265  $noti->send();
1266  }
1267  }
1268  }
1269  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_assigned"), true);
1270  $this->ctrl->redirect($this, 'participants');
1271  }
1272 
1277  protected function parseWaitingListTable()
1278  {
1279  $wait = $this->initWaitingList();
1280 
1281  $wait_users = $this->filterUserIdsByRbacOrPositionOfCurrentUser($wait->getUserIds());
1282  if (!count($wait_users)) {
1283  return null;
1284  }
1285 
1286  include_once './Services/Membership/classes/class.ilWaitingListTableGUI.php';
1287  $waiting_table = new ilWaitingListTableGUI($this, $this->getParentObject(), $wait);
1288  $waiting_table->setUserIds(
1289  $wait_users
1290  );
1291  $waiting_table->readUserData();
1292  $waiting_table->setTitle($this->lng->txt('crs_waiting_list'));
1293 
1294  return $waiting_table;
1295  }
1296 
1302  {
1303  if (!is_array($_POST["waiting"])) {
1304  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1305  $this->ctrl->redirect($this, 'participants');
1306  }
1307 
1308 
1309  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1310  $c_gui = new ilConfirmationGUI();
1311 
1312  // set confirm/cancel commands
1313  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
1314  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1315  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1316  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
1317 
1318  foreach ($_POST["waiting"] as $waiting) {
1319  $name = ilObjUser::_lookupName($waiting);
1320 
1321  $c_gui->addItem(
1322  'waiting[]',
1323  $name['user_id'],
1324  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1325  ilUtil::getImagePath('icon_usr.svg')
1326  );
1327  }
1328 
1329  $this->tpl->setContent($c_gui->getHTML());
1330  return true;
1331  }
1332 
1338  public function assignFromWaitingList()
1339  {
1340  if (!count($_POST["waiting"])) {
1341  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1342  $this->ctrl->redirect($this, 'participants');
1343  }
1344 
1345  $waiting_list = $this->initWaitingList();
1346 
1347  $added_users = 0;
1348  foreach ($_POST["waiting"] as $user_id) {
1349  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
1350  continue;
1351  }
1352  if ($this->getMembersObject()->isAssigned($user_id)) {
1353  continue;
1354  }
1355 
1356  if ($this instanceof ilCourseMembershipGUI) {
1357  $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
1358  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
1359  $this->getParentObject()->checkLPStatusSync($user_id);
1360  }
1361  if ($this instanceof ilGroupMembershipGUI) {
1362  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1363  $this->getMembersObject()->add($user_id, IL_GRP_MEMBER);
1364  $this->getMembersObject()->sendNotification(
1366  $user_id,
1367  true
1368  );
1369  }
1370  if ($this instanceof ilSessionMembershipGUI) {
1371  $this->getMembersObject()->register($user_id);
1373  $noti->setRefId($this->getParentObject()->getRefId());
1374  $noti->setRecipients(array($user_id));
1376  $noti->send();
1377  }
1378 
1379  $waiting_list->removeFromList($user_id);
1380  ++$added_users;
1381  }
1382 
1383  if ($added_users) {
1384  ilUtil::sendSuccess($this->lng->txt("crs_users_added"), true);
1385  $this->ctrl->redirect($this, 'participants');
1386  } else {
1387  ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"), true);
1388  $this->ctrl->redirect($this, 'participants');
1389  }
1390  }
1391 
1396  public function confirmRefuseFromList()
1397  {
1398  if (!is_array($_POST["waiting"])) {
1399  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1400  $this->ctrl->redirect($this, 'participants');
1401  }
1402 
1403  $this->lng->loadLanguageModule('mmbr');
1404 
1405  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1406  $c_gui = new ilConfirmationGUI();
1407 
1408  // set confirm/cancel commands
1409  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
1410  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1411  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1412  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
1413 
1414  foreach ($_POST["waiting"] as $waiting) {
1415  $name = ilObjUser::_lookupName($waiting);
1416 
1417  $c_gui->addItem(
1418  'waiting[]',
1419  $name['user_id'],
1420  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1421  ilUtil::getImagePath('icon_usr.svg')
1422  );
1423  }
1424 
1425  $this->tpl->setContent($c_gui->getHTML());
1426  return true;
1427  }
1428 
1435  protected function refuseFromList()
1436  {
1437  if (!count($_POST['waiting'])) {
1438  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
1439  $this->ctrl->redirect($this, 'participants');
1440  }
1441 
1442  $waiting_list = $this->initWaitingList();
1443 
1444  foreach ($_POST["waiting"] as $user_id) {
1445  $waiting_list->removeFromList($user_id);
1446 
1447  if ($this instanceof ilCourseMembershipGUI) {
1448  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $user_id, true);
1449  }
1450  if ($this instanceof ilGroupMembershipGUI) {
1451  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1452  $this->getMembersObject()->sendNotification(
1454  $user_id,
1455  true
1456  );
1457  }
1458  if ($this instanceof ilSessionMembershipGUI) {
1459  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1461  $noti->setRefId($this->getParentObject()->getRefId());
1462  $noti->setRecipients(array($user_id));
1464  $noti->send();
1465  }
1466  }
1467  ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'), true);
1468  $this->ctrl->redirect($this, 'participants');
1469  }
1470 
1474  protected function addToClipboard()
1475  {
1476  $users = (array) $_POST['participants'];
1477  if (!count($users)) {
1478  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1479  $this->ctrl->redirect($this, 'participants');
1480  }
1481  include_once './Services/User/classes/class.ilUserClipboard.php';
1482  $clip = ilUserClipboard::getInstance($GLOBALS['ilUser']->getId());
1483  $clip->add($users);
1484  $clip->save();
1485 
1486  $this->lng->loadLanguageModule('user');
1487  ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
1488  $this->ctrl->redirect($this, 'participants');
1489  }
1490 
1494  protected function getDefaultRole()
1495  {
1496  return null;
1497  }
1498 
1502  protected function activateSubTab($a_sub_tab)
1503  {
1507  $tabs = $GLOBALS['DIC']['ilTabs'];
1508  $tabs->activateSubTab($a_sub_tab);
1509  }
1510 
1511 
1512 
1513 
1518  protected function printMembers()
1519  {
1520  global $DIC;
1521 
1522  $ilTabs = $DIC->tabs();
1523 
1524  $this->checkPermission('read');
1525 
1526  $ilTabs->clearTargets();
1527  $ilTabs->setBackTarget(
1528  $this->lng->txt('back'),
1529  $this->ctrl->getLinkTarget($this, 'participants')
1530  );
1531 
1532  $list = $this->initAttendanceList();
1533  $form = $list->initForm('printMembersOutput');
1534  $this->tpl->setContent($form->getHTML());
1535  }
1536 
1540  protected function printMembersOutput()
1541  {
1542  $list = $this->initAttendanceList();
1543  $list->initFromForm();
1544  $list->setCallback(array($this, 'getAttendanceListUserData'));
1545  $this->member_data = $this->getPrintMemberData(
1547  $this->getMembersObject()->getParticipants()
1548  )
1549  );
1550 
1551  $list->getNonMemberUserData($this->member_data);
1552 
1553  $list->getFullscreenHTML();
1554  exit();
1555  }
1556 
1560  protected function printForMembersOutput()
1561  {
1562  $list = $this->initAttendanceList();
1563  $list->setTitle($this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle());
1564  $list->setId(0);
1565  $form = $list->initForm('printForMembersOutput');
1566  $list->initFromForm();
1567  $list->setCallback(array($this, 'getAttendanceListUserData'));
1568  $this->member_data = $this->getPrintMemberData($this->getMembersObject()->getParticipants());
1569  $list->getNonMemberUserData($this->member_data);
1570 
1571  $list->getFullscreenHTML();
1572  exit();
1573  }
1574 
1578  protected function jump2UsersGallery()
1579  {
1580  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
1581  }
1582 
1583 
1584 
1585 
1589  protected function initAttendanceList($a_for_members = false)
1590  {
1591  global $DIC;
1592 
1596  $waiting_list = $this->initWaitingList();
1597 
1598  if ($this instanceof ilSessionMembershipGUI) {
1599  $member_id = $DIC->repositoryTree()->checkForParentType(
1600  $this->getParentObject()->getRefId(),
1601  'grp'
1602  );
1603  if (!$member_id) {
1604  $member_id = $DIC->repositoryTree()->checkForParentType(
1605  $this->getParentObject()->getRefId(),
1606  'crs'
1607  );
1608  }
1609  if (!$member_id) {
1610  $DIC->logger()->sess()->warning('Cannot find parent course or group for ref_id: ' . $this->getParentObject()->getRefId());
1611  $member_id = $this->getParentObject()->getRefId();
1612  }
1613  $part = ilParticipants::getInstance($member_id);
1614 
1615  $list = new ilAttendanceList(
1616  $this,
1617  $this->getParentObject(),
1618  $part,
1619  $waiting_list
1620  );
1621  } else {
1622  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1623  $list = new ilAttendanceList(
1624  $this,
1625  $this->getParentObject(),
1626  $this->getMembersObject(),
1627  $waiting_list
1628  );
1629  }
1630  $list->setId($this->getParentObject()->getType() . '_memlist_' . $this->getParentObject()->getId());
1631 
1632  $list->setTitle(
1633  $this->lng->txt($this->getParentObject()->getType() . '_members_print_title'),
1634  $this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle()
1635  );
1636 
1637  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
1638  $show_tracking =
1640  if ($show_tracking) {
1641  include_once('./Services/Object/classes/class.ilObjectLP.php');
1642  $olp = ilObjectLP::getInstance($this->getParentObject()->getId());
1643  $show_tracking = $olp->isActive();
1644  }
1645  if ($show_tracking) {
1646  $list->addPreset('progress', $this->lng->txt('learning_progress'), true);
1647  }
1648 
1649  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1653  $privacy = ilPrivacySettings::_getInstance();
1654  if ($privacy->enabledAccessTimesByType($this->getParentObject()->getType())) {
1655  $list->addPreset('access', $this->lng->txt('last_access'), true);
1656  }
1657 
1658  switch ($this->getParentObject()->getType()) {
1659  case 'crs':
1660  $list->addPreset('status', $this->lng->txt('crs_status'), true);
1661  $list->addPreset('passed', $this->lng->txt('crs_passed'), true);
1662  break;
1663 
1664  case 'sess':
1665  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1666  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1667  if ($this->getParentObject()->enabledRegistration()) {
1668  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1669  }
1670  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1671  $list->addBlank($this->lng->txt('sess_signature'));
1672 
1673  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1674  break;
1675 
1676  case 'grp':
1677  default:
1678  break;
1679  }
1680 
1681  return $list;
1682  }
1683 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
global $ilErr
Definition: raiseError.php:16
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"]
updateParticipants()
update members
assignFromWaitingList()
Assign from waiting list type $rbacsystem.
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
Class ilMailMemberCourseRoles.
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
if($format !==null) $name
Definition: metadata.php:146
static getMapGUI()
Get an instance of the GUI class.
Class ilMailMemberCourseRoles.
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)
This class handles base functions for mail handling.
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.
Create styles array
The data for the language used.
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.
const CONTEXT_KEY
Session parameter for the context.
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.
parseSubscriberTable()
Parse table of subscription request.
Create new PHPExcel object
obj_idprivate
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)
static getLogger($a_component_id)
Get component logger.
membersMap()
Members map.
static _getInstance()
Get instance of ilPrivacySettings.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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)
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.
participantsApplyFilter()
Apply filter for participant table.
Confirmation screen class.