ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMembershipGUI Class Reference

Base class for member tab content. More...

+ Inheritance diagram for ilMembershipGUI:
+ Collaboration diagram for ilMembershipGUI:

Public Member Functions

 __construct (ilObjectGUI $repository_gui, ilObject $repository_obj)
 Constructor. More...
 
 getParentGUI ()
 Get parent gui. More...
 
 getParentObject ()
 Get parent object. More...
 
 getMembersObject ()
 Get member object. More...
 
 filterUserIdsByRbacOrPositionOfCurrentUser ($a_user_ids)
 Filter user ids by access. More...
 
 updateParticipants ()
 update members More...
 
 createMailSignature ()
 
 addMemberTab (ilTabsGUI $tabs, $a_is_participant=false)
 add member tab More...
 
 readMemberData (array $usr_ids, array $columns)
 Required for member table guis. More...
 
 getLocalRoles ()
 Get parent roles. More...
 
 confirmAssignSubscribers ()
 Show subscription confirmation. More...
 
 confirmRefuseSubscribers ()
 Refuse subscriber confirmation. More...
 
 assignSubscribers ()
 Do assignment of subscription request type $rbacsystem type $ilErr. More...
 
 confirmAssignFromWaitingList ()
 Assign from waiting list (confirmatoin) More...
 
 assignFromWaitingList ()
 Assign from waiting list type $rbacsystem. More...
 
 confirmRefuseFromList ()
 Refuse from waiting list (confirmation) More...
 

Protected Member Functions

 getLanguage ()
 
 getCtrl ()
 
 getLogger ()
 
 getMailMemberRoles ()
 
 checkPermissionBool ($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
 Check permission. More...
 
 checkRbacOrPositionAccessBool ($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
 Check if rbac or position access is granted. More...
 
 checkPermission ($a_permission, $a_cmd="")
 Check permission If not granted redirect to parent gui. More...
 
 checkRbacOrPermissionAccess ($a_rbac_perm, $a_pos_perm)
 check rbac or position access More...
 
 canAddOrSearchUsers ()
 Check if current user is allowed to add / search users. More...
 
 participants ()
 Show participant table, subscriber table, wating list table;. More...
 
 participantsApplyFilter ()
 Apply filter for participant table. More...
 
 participantsResetFilter ()
 reset participants filter More...
 
 editMember ()
 Edit one participant. More...
 
 editParticipants ($post_participants=array())
 Edit participants. More...
 
 confirmDeleteParticipants ()
 Show confirmation screen for participants deletion. More...
 
 deleteParticipants ()
 
 sendMailToSelectedUsers ()
 Send mail to selected users. More...
 
 getMailContextOptions ()
 Get mail context options. More...
 
 membersMap ()
 Members map. More...
 
 mailMembersBtn ()
 Mail to members view type $ilToolbar. More...
 
 showParticipantsToolbar ()
 Show participants toolbar. More...
 
 showMemberExportToolbarButton (ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
 Show member export button. More...
 
 showMailToMemberToolbarButton (ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
 Show mail to member toolbar button. More...
 
 getDefaultCommand ()
 Get default command. More...
 
 getMemberTabName ()
 Get member tab name. More...
 
 setSubTabs (ilTabsGUI $tabs)
 Set sub tabs. More...
 
 parseSubscriberTable ()
 Parse table of subscription request. More...
 
 initSubscriberTable ()
 
 refuseSubscribers ()
 Refuse subscribers type $rbacsystem. More...
 
 parseWaitingListTable ()
 Parse table of subscription request. More...
 
 refuseFromList ()
 refuse from waiting list More...
 
 addToClipboard ()
 Add selected users to user clipboard. More...
 
 getDefaultRole ()
 
 printMembers ()
 Print members. More...
 
 printMembersOutput ()
 print members output More...
 
 printForMembersOutput ()
 print members output More...
 
 jump2UsersGallery ()
 

Protected Attributes

 $lng = null
 
 $ctrl = null
 
 $logger = null
 
 $tpl
 
 $access
 

Private Attributes

 $repository_object = null
 
 $repository_gui = null
 

Detailed Description

Base class for member tab content.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilMembershipGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMembershipGUI::__construct ( ilObjectGUI  $repository_gui,
ilObject  $repository_obj 
)

Constructor.

Parameters
ilObject$repository_obj

Definition at line 53 of file class.ilMembershipGUI.php.

References $DIC, $GLOBALS, $repository_gui, and getParentObject().

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  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
+ Here is the call graph for this function:

Member Function Documentation

◆ addMemberTab()

ilMembershipGUI::addMemberTab ( ilTabsGUI  $tabs,
  $a_is_participant = false 
)

add member tab

Parameters
ilTabsGUI$tabs
bool$a_is_participant

Definition at line 1004 of file class.ilMembershipGUI.php.

References $DIC, $GLOBALS, ilTabsGUI\addTab(), checkRbacOrPositionAccessBool(), getMemberTabName(), and getParentObject().

1005  {
1006  global $DIC;
1007 
1008  $ilAccess = $DIC->access();
1009 
1010  // no read no tab
1011  if (!$ilAccess->checkAccess('read', '', $this->getParentObject()->getRefId())) {
1012  return false;
1013  }
1014 
1015 
1016  include_once './Services/Mail/classes/class.ilMail.php';
1017  $mail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
1018 
1019  $member_tab_name = $this->getMemberTabName();
1020 
1021  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
1022  'manage_members',
1023  'manage_members',
1024  $this->getParentObject()->getRefId()
1025  );
1026 
1027  if ($has_manage_members_permission) {
1028  $tabs->addTab(
1029  'members',
1030  $member_tab_name,
1031  $this->ctrl->getLinkTarget($this, '')
1032  );
1033  } elseif (
1034  (bool) $this->getParentObject()->getShowMembers() && $a_is_participant
1035  ) {
1036  $tabs->addTab(
1037  'members',
1038  $member_tab_name,
1039  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilusersgallerygui'), 'view')
1040  );
1041  } elseif (
1042  $this->getParentObject()->getMailToMembersType() == 1 &&
1043  $GLOBALS['DIC']['rbacsystem']->checkAccess('internal_mail', $mail->getMailObjectReferenceId()) &&
1044  $a_is_participant
1045  ) {
1046  $tabs->addTab(
1047  'members',
1048  $member_tab_name,
1049  $this->ctrl->getLinkTarget($this, "mailMembersBtn")
1050  );
1051  }
1052  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$DIC
Definition: xapitoken.php:46
addTab($a_id, $a_text, $a_link, $a_frame="")
Add a Tab.
getParentObject()
Get parent object.
getMemberTabName()
Get member tab name.
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
Check if rbac or position access is granted.
+ Here is the call graph for this function:

◆ addToClipboard()

ilMembershipGUI::addToClipboard ( )
protected

Add selected users to user clipboard.

Definition at line 1556 of file class.ilMembershipGUI.php.

References $_POST, $GLOBALS, ilUserClipboard\getInstance(), and ilUtil\sendFailure().

1557  {
1558  // begin-patch clipboard
1559  $users = [];
1560  if (isset($_POST['participants'])) {
1561  $users = (array) $_POST['participants'];
1562  } elseif (isset($_POST['subscribers'])) {
1563  $users = (array) $_POST['subscribers'];
1564  } elseif (isset($_POST['waiting'])) {
1565  $users = (array) $_POST['waiting'];
1566  }
1567  // end-patch clipboard
1568  if (!count($users)) {
1569  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1570  $this->ctrl->redirect($this, 'participants');
1571  }
1572  include_once './Services/User/classes/class.ilUserClipboard.php';
1573  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
1574  $clip->add($users);
1575  $clip->save();
1576 
1577  $this->lng->loadLanguageModule('user');
1578  ilUtil::sendSuccess($this->lng->txt('clipboard_user_added'), true);
1579  $this->ctrl->redirect($this, 'participants');
1580  }
static getInstance($a_usr_id)
Get singelton instance.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ assignFromWaitingList()

ilMembershipGUI::assignFromWaitingList ( )

Assign from waiting list type $rbacsystem.

Returns
boolean

Definition at line 1420 of file class.ilMembershipGUI.php.

References $_POST, ilObjectFactory\getInstanceByObjId(), getMembersObject(), getParentObject(), IL_CRS_MEMBER, IL_GRP_MEMBER, ilUtil\sendFailure(), ilSessionMembershipMailNotification\TYPE_ACCEPTED_SUBSCRIPTION_MEMBER, and ilGroupMembershipMailNotification\TYPE_ACCEPTED_SUBSCRIPTION_MEMBER.

1421  {
1422  if (!array_key_exists('waiting', $_POST) || !count($_POST["waiting"])) {
1423  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1424  $this->ctrl->redirect($this, 'participants');
1425  }
1426 
1427  $waiting_list = $this->initWaitingList();
1428 
1429  $added_users = 0;
1430  foreach ($_POST["waiting"] as $user_id) {
1431  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($user_id, false)) {
1432  continue;
1433  }
1434  if ($this->getMembersObject()->isAssigned($user_id)) {
1435  continue;
1436  }
1437 
1438  if ($this instanceof ilCourseMembershipGUI) {
1439  $this->getMembersObject()->add($user_id, IL_CRS_MEMBER);
1440  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_USER, $user_id, true);
1441  $this->getParentObject()->checkLPStatusSync($user_id);
1442  }
1443  if ($this instanceof ilGroupMembershipGUI) {
1444  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1445  $this->getMembersObject()->add($user_id, IL_GRP_MEMBER);
1446  $this->getMembersObject()->sendNotification(
1448  $user_id,
1449  true
1450  );
1451  }
1452  if ($this instanceof ilSessionMembershipGUI) {
1453  $this->getMembersObject()->register($user_id);
1455  $noti->setRefId($this->getParentObject()->getRefId());
1456  $noti->setRecipients(array($user_id));
1458  $noti->send();
1459  }
1460 
1461  $waiting_list->removeFromList($user_id);
1462  ++$added_users;
1463  }
1464 
1465  if ($added_users) {
1466  ilUtil::sendSuccess($this->lng->txt("crs_users_added"), true);
1467  $this->ctrl->redirect($this, 'participants');
1468  } else {
1469  ilUtil::sendFailure($this->lng->txt("crs_users_already_assigned"), true);
1470  $this->ctrl->redirect($this, 'participants');
1471  }
1472  }
getMembersObject()
Get member object.
const IL_GRP_MEMBER
const IL_CRS_MEMBER
GUI class for membership features.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
getParentObject()
Get parent object.
$_POST["username"]
+ Here is the call graph for this function:

◆ assignSubscribers()

ilMembershipGUI::assignSubscribers ( )

Do assignment of subscription request type $rbacsystem type $ilErr.

Returns
boolean

Definition at line 1313 of file class.ilMembershipGUI.php.

References $_POST, $DIC, $ilErr, getMembersObject(), getParentObject(), ilUtil\sendFailure(), ilSessionMembershipMailNotification\TYPE_ACCEPTED_SUBSCRIPTION_MEMBER, and ilGroupMembershipMailNotification\TYPE_ACCEPTED_SUBSCRIPTION_MEMBER.

1314  {
1315  global $DIC;
1316 
1317  $ilErr = $DIC['ilErr'];
1318 
1319  if (!is_array($_POST["subscribers"])) {
1320  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1321  $this->ctrl->redirect($this, 'participants');
1322  }
1323 
1324  if (!$this->getMembersObject()->assignSubscribers($_POST["subscribers"])) {
1325  ilUtil::sendFailure($ilErr->getMessage(), true);
1326  $this->ctrl->redirect($this, 'participants');
1327  } else {
1328  foreach ($_POST["subscribers"] as $usr_id) {
1329  if ($this instanceof ilCourseMembershipGUI) {
1330  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_ACCEPT_SUBSCRIBER, $usr_id);
1331  $this->getParentObject()->checkLPStatusSync($usr_id);
1332  }
1333  if ($this instanceof ilGroupMembershipGUI) {
1334  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1335  $this->getMembersObject()->sendNotification(
1337  $usr_id
1338  );
1339  }
1340  if ($this instanceof ilSessionMembershipGUI) {
1341  // todo refactor to participants
1342  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1344  $noti->setRefId($this->getParentObject()->getRefId());
1345  $noti->setRecipients(array($usr_id));
1347  $noti->send();
1348  }
1349  }
1350  }
1351  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_assigned"), true);
1352  $this->ctrl->redirect($this, 'participants');
1353  }
getMembersObject()
Get member object.
$ilErr
Definition: raiseError.php:18
assignSubscribers()
Do assignment of subscription request type $rbacsystem type $ilErr.
GUI class for membership features.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
$_POST["username"]
+ Here is the call graph for this function:

◆ canAddOrSearchUsers()

ilMembershipGUI::canAddOrSearchUsers ( )
protected

Check if current user is allowed to add / search users.

Returns
bool

Definition at line 196 of file class.ilMembershipGUI.php.

References checkPermissionBool().

Referenced by showParticipantsToolbar().

197  {
198  return $this->checkPermissionBool('manage_members');
199  }
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPermission()

ilMembershipGUI::checkPermission (   $a_permission,
  $a_cmd = "" 
)
protected

Check permission If not granted redirect to parent gui.

Parameters
string$a_permission
string$a_cmd

Definition at line 168 of file class.ilMembershipGUI.php.

References checkPermissionBool(), getParentGUI(), and ilUtil\sendFailure().

Referenced by ilSessionMembershipGUI\deleteParticipants(), filterUserIdsByRbacOrPositionOfCurrentUser(), ilLearningSequenceMembershipGUI\printMembers(), printMembers(), and ilSessionMembershipGUI\updateMembers().

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  }
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
getParentGUI()
Get parent gui.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPermissionBool()

ilMembershipGUI::checkPermissionBool (   $a_permission,
  $a_cmd = '',
  $a_type = '',
  $a_ref_id = 0 
)
protected

Check permission.

Parameters
type$a_permission
type$a_cmd
type$a_type
type$a_ref_id

Definition at line 139 of file class.ilMembershipGUI.php.

References getParentObject().

Referenced by canAddOrSearchUsers(), checkPermission(), ilSessionMembershipGUI\checkRbacOrPositionAccessBool(), and confirmDeleteParticipants().

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  }
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkRbacOrPermissionAccess()

ilMembershipGUI::checkRbacOrPermissionAccess (   $a_rbac_perm,
  $a_pos_perm 
)
protected

check rbac or position access

Parameters
$a_rbac_perm
$a_pos_perm

Definition at line 182 of file class.ilMembershipGUI.php.

References checkRbacOrPositionAccessBool(), getParentGUI(), and ilUtil\sendFailure().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

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  }
getParentGUI()
Get parent gui.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
Check if rbac or position access is granted.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkRbacOrPositionAccessBool()

ilMembershipGUI::checkRbacOrPositionAccessBool (   $a_rbac_perm,
  $a_pos_perm,
  $a_ref_id = 0 
)
protected

Check if rbac or position access is granted.

Parameters
string$a_rbac_perm
string$a_pos_perm
int$a_ref_id

Definition at line 153 of file class.ilMembershipGUI.php.

References getParentObject().

Referenced by addMemberTab(), ilCourseMembershipGUI\assignMembers(), checkRbacOrPermissionAccess(), filterUserIdsByRbacOrPositionOfCurrentUser(), getDefaultCommand(), ilLearningSequenceMembershipGUI\printMembers(), ilLearningSequenceMembershipGUI\setSubTabs(), and setSubTabs().

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  }
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmAssignFromWaitingList()

ilMembershipGUI::confirmAssignFromWaitingList ( )

Assign from waiting list (confirmatoin)

Returns
boolean

Definition at line 1383 of file class.ilMembershipGUI.php.

References $_POST, $name, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

1384  {
1385  if (!is_array($_POST["waiting"])) {
1386  ilUtil::sendFailure($this->lng->txt("crs_no_users_selected"), true);
1387  $this->ctrl->redirect($this, 'participants');
1388  }
1389 
1390 
1391  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1392  $c_gui = new ilConfirmationGUI();
1393 
1394  // set confirm/cancel commands
1395  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
1396  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1397  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1398  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
1399 
1400  foreach ($_POST["waiting"] as $waiting) {
1401  $name = ilObjUser::_lookupName($waiting);
1402 
1403  $c_gui->addItem(
1404  'waiting[]',
1405  $name['user_id'],
1406  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1407  ilUtil::getImagePath('icon_usr.svg')
1408  );
1409  }
1410 
1411  $this->tpl->setContent($c_gui->getHTML());
1412  return true;
1413  }
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:230
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmAssignSubscribers()

ilMembershipGUI::confirmAssignSubscribers ( )

Show subscription confirmation.

Returns
boolean

Definition at line 1188 of file class.ilMembershipGUI.php.

References $_POST, $name, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

1189  {
1190  if (!is_array($_POST["subscribers"])) {
1191  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1192  $this->ctrl->redirect($this, 'participants');
1193  }
1194 
1195  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1196  $c_gui = new ilConfirmationGUI();
1197 
1198  // set confirm/cancel commands
1199  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
1200  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
1201  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1202  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
1203 
1204  foreach ($_POST["subscribers"] as $subscribers) {
1205  $name = ilObjUser::_lookupName($subscribers);
1206 
1207  $c_gui->addItem(
1208  'subscribers[]',
1209  $name['user_id'],
1210  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1211  ilUtil::getImagePath('icon_usr.svg')
1212  );
1213  }
1214 
1215  $this->tpl->setContent($c_gui->getHTML());
1216  return true;
1217  }
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:230
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteParticipants()

ilMembershipGUI::confirmDeleteParticipants ( )
protected

Show confirmation screen for participants deletion.

Definition at line 623 of file class.ilMembershipGUI.php.

References $_POST, $DIC, $GLOBALS, $ilUser, $name, ilObjUser\_lookupName(), checkPermissionBool(), ilUtil\getImagePath(), getMembersObject(), ilCourseReferencePathInfo\isReferenceMemberUpdateConfirmationRequired(), ilUtil\sendFailure(), and ilUtil\sendInfo().

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 
668  $this->repository_object->getRefId(),
669  $participants
670  )) {
671  return $this->showDeleteParticipantsConfirmationWithLinkedCourses($participants);
672  }
673 
674  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
675  $confirm = new ilConfirmationGUI();
676  $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
677  $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
678  $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
679  $confirm->setCancel($this->lng->txt('cancel'), 'participants');
680 
681  foreach ($participants as $usr_id) {
682  $name = ilObjUser::_lookupName($usr_id);
683 
684  $confirm->addItem(
685  'participants[]',
686  $name['user_id'],
687  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
688  ilUtil::getImagePath('icon_usr.svg')
689  );
690  }
691 
692  $this->tpl->setContent($confirm->getHTML());
693  }
static _lookupName($a_user_id)
lookup user name
getMembersObject()
Get member object.
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
static isReferenceMemberUpdateConfirmationRequired(int $course_ref_id, array $participants)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($format !==null) $name
Definition: metadata.php:230
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmRefuseFromList()

ilMembershipGUI::confirmRefuseFromList ( )

Refuse from waiting list (confirmation)

Returns
boolean

Definition at line 1478 of file class.ilMembershipGUI.php.

References $_POST, $name, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

1479  {
1480  if (!is_array($_POST["waiting"])) {
1481  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1482  $this->ctrl->redirect($this, 'participants');
1483  }
1484 
1485  $this->lng->loadLanguageModule('mmbr');
1486 
1487  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1488  $c_gui = new ilConfirmationGUI();
1489 
1490  // set confirm/cancel commands
1491  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
1492  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1493  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1494  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
1495 
1496  foreach ($_POST["waiting"] as $waiting) {
1497  $name = ilObjUser::_lookupName($waiting);
1498 
1499  $c_gui->addItem(
1500  'waiting[]',
1501  $name['user_id'],
1502  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1503  ilUtil::getImagePath('icon_usr.svg')
1504  );
1505  }
1506 
1507  $this->tpl->setContent($c_gui->getHTML());
1508  return true;
1509  }
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:230
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmRefuseSubscribers()

ilMembershipGUI::confirmRefuseSubscribers ( )

Refuse subscriber confirmation.

Returns
boolean

Definition at line 1223 of file class.ilMembershipGUI.php.

References $_POST, $name, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

1224  {
1225  if (!is_array($_POST["subscribers"])) {
1226  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1227  $this->ctrl->redirect($this, 'participants');
1228  }
1229 
1230  $this->lng->loadLanguageModule('mmbr');
1231 
1232  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1233  $c_gui = new ilConfirmationGUI();
1234 
1235  // set confirm/cancel commands
1236  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
1237  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
1238  $c_gui->setCancel($this->lng->txt("cancel"), "participants");
1239  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
1240 
1241  foreach ($_POST["subscribers"] as $subscribers) {
1242  $name = ilObjUser::_lookupName($subscribers);
1243 
1244  $c_gui->addItem(
1245  'subscribers[]',
1246  $name['user_id'],
1247  $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
1248  ilUtil::getImagePath('icon_usr.svg')
1249  );
1250  }
1251 
1252  $this->tpl->setContent($c_gui->getHTML());
1253  return true;
1254  }
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:230
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ createMailSignature()

ilMembershipGUI::createMailSignature ( )
Todo:
better implementation Create Mail signature

Definition at line 973 of file class.ilMembershipGUI.php.

References getParentGUI().

Referenced by sendMailToSelectedUsers().

974  {
975  return $this->getParentGUI()->createMailSignature();
976  }
getParentGUI()
Get parent gui.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteParticipants()

ilMembershipGUI::deleteParticipants ( )
protected

Definition at line 695 of file class.ilMembershipGUI.php.

References $_POST, $DIC, $GLOBALS, $ilUser, getMembersObject(), getParentObject(), ilUtil\sendFailure(), ilLearningSequenceMembershipMailNotification\TYPE_DISMISS_MEMBER, and ilGroupMembershipMailNotification\TYPE_DISMISS_MEMBER.

Referenced by ilCourseMembershipGUI\deleteParticipantsWithLinkedCourses().

696  {
697  global $DIC;
698 
699  $rbacreview = $DIC['rbacreview'];
700  $rbacsystem = $DIC['rbacsystem'];
701  $ilAccess = $DIC['ilAccess'];
702  $ilUser = $DIC['ilUser'];
703 
704  $participants = (array) $_POST['participants'];
705 
706  if (!is_array($participants) or !count($participants)) {
707  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
708  $this->ctrl->redirect($this, 'participants');
709  }
710 
711  // If the user doesn't have the edit_permission and is not administrator, he may not remove
712  // members who have the course administrator role
713  if (
714  !$ilAccess->checkAccess('edit_permission', '', $this->getParentObject()->getRefId()) &&
715  !$this->getMembersObject()->isAdmin($GLOBALS['DIC']['ilUser']->getId())
716  ) {
717  foreach ($participants as $part) {
718  if ($this->getMembersObject()->isAdmin($part)) {
719  ilUtil::sendFailure($this->lng->txt('msg_no_perm_perm'), true);
720  $this->ctrl->redirect($this, 'participants');
721  }
722  }
723  }
724 
725  if (!$this->getMembersObject()->deleteParticipants($participants)) {
726  ilUtil::sendFailure('Error deleting participants.', true);
727  $this->ctrl->redirect($this, 'participants');
728  } else {
729  foreach ((array) $_POST["participants"] as $usr_id) {
730  $mail_type = 0;
731  // @todo more generic
732  switch ($this->getParentObject()->getType()) {
733  case 'crs':
734  $mail_type = $this->getMembersObject()->NOTIFY_DISMISS_MEMBER;
735  break;
736  case 'grp':
737  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
739  break;
740  case 'lso':
742  break;
743  }
744  $this->getMembersObject()->sendNotification($mail_type, $usr_id);
745  }
746  }
747  ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
748  $this->ctrl->redirect($this, "participants");
749 
750  return true;
751  }
getMembersObject()
Get member object.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editMember()

ilMembershipGUI::editMember ( )
protected

Edit one participant.

Definition at line 459 of file class.ilMembershipGUI.php.

References editParticipants(), and getParentObject().

460  {
461  $this->activateSubTab($this->getParentObject()->getType() . "_member_administration");
462  return $this->editParticipants(array($_REQUEST['member_id']));
463  }
getParentObject()
Get parent object.
editParticipants($post_participants=array())
Edit participants.
+ Here is the call graph for this function:

◆ editParticipants()

ilMembershipGUI::editParticipants (   $post_participants = array())
protected

Edit participants.

Parameters
array$post_participants

Definition at line 469 of file class.ilMembershipGUI.php.

References $_POST, getMembersObject(), and ilUtil\sendFailure().

Referenced by editMember().

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  }
getMembersObject()
Get member object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterUserIdsByRbacOrPositionOfCurrentUser()

ilMembershipGUI::filterUserIdsByRbacOrPositionOfCurrentUser (   $a_user_ids)

◆ getCtrl()

ilMembershipGUI::getCtrl ( )
protected
Returns
ilCtrl

Definition at line 80 of file class.ilMembershipGUI.php.

References $ctrl.

Referenced by ilSessionMembershipGUI\updateMembers().

81  {
82  return $this->ctrl;
83  }
+ Here is the caller graph for this function:

◆ getDefaultCommand()

ilMembershipGUI::getDefaultCommand ( )
protected

Get default command.

Returns
string

Definition at line 982 of file class.ilMembershipGUI.php.

References checkRbacOrPositionAccessBool(), and getParentObject().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

983  {
984  $has_manage_members_permission = $this->checkRbacOrPositionAccessBool(
985  'manage_members',
986  'manage_members',
987  $this->getParentObject()->getRefId()
988  );
989  if ($has_manage_members_permission) {
990  return 'participants';
991  }
992 
993  if ($this->getParentObject()->getShowMembers()) {
994  return 'jump2UsersGallery';
995  }
996  return 'mailMembersBtn';
997  }
getParentObject()
Get parent object.
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
Check if rbac or position access is granted.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultRole()

ilMembershipGUI::getDefaultRole ( )
protected
Returns
null

Definition at line 1585 of file class.ilMembershipGUI.php.

References $GLOBALS.

Referenced by showParticipantsToolbar().

1586  {
1587  return null;
1588  }
+ Here is the caller graph for this function:

◆ getLanguage()

ilMembershipGUI::getLanguage ( )
protected
Returns
ilLanguage

Definition at line 72 of file class.ilMembershipGUI.php.

References $lng.

Referenced by ilSessionMembershipGUI\updateMembers().

73  {
74  return $this->lng;
75  }
+ Here is the caller graph for this function:

◆ getLocalRoles()

ilMembershipGUI::getLocalRoles ( )

Get parent roles.

Returns
type

Definition at line 1152 of file class.ilMembershipGUI.php.

References getParentGUI().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

1153  {
1154  return $this->getParentGUI()->getLocalRoles();
1155  }
getParentGUI()
Get parent gui.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLogger()

ilMembershipGUI::getLogger ( )
protected
Returns

Definition at line 88 of file class.ilMembershipGUI.php.

References $logger.

89  {
90  return $this->logger;
91  }

◆ getMailContextOptions()

ilMembershipGUI::getMailContextOptions ( )
protected

Get mail context options.

Returns
array

Definition at line 800 of file class.ilMembershipGUI.php.

Referenced by sendMailToSelectedUsers().

801  {
802  $context_options = [];
803  return $context_options;
804  }
+ Here is the caller graph for this function:

◆ getMailMemberRoles()

ilMembershipGUI::getMailMemberRoles ( )
protected
Returns
null

Definition at line 127 of file class.ilMembershipGUI.php.

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

128  {
129  return null;
130  }
+ Here is the caller graph for this function:

◆ getMembersObject()

ilMembershipGUI::getMembersObject ( )

Get member object.

Returns
ilParticipants

Definition at line 116 of file class.ilMembershipGUI.php.

References ilParticipants\getInstance(), getParentObject(), and participants().

Referenced by assignFromWaitingList(), ilGroupMembershipGUI\assignMembers(), ilCourseMembershipGUI\assignMembers(), assignSubscribers(), confirmDeleteParticipants(), ilSessionMembershipGUI\deleteParticipants(), deleteParticipants(), ilCourseMembershipGUI\deleteParticipantsWithLinkedCourses(), editParticipants(), filterUserIdsByRbacOrPositionOfCurrentUser(), ilSessionMembershipGUI\getAttendanceListUserData(), ilCourseMembershipGUI\getPrintMemberData(), jump2UsersGallery(), parseSubscriberTable(), printForMembersOutput(), printMembersOutput(), refuseFromList(), refuseSubscribers(), updateParticipants(), ilGroupMembershipGUI\updateParticipantsStatus(), and ilCourseMembershipGUI\updateParticipantsStatus().

117  {
118  if ($this->participants instanceof ilParticipants) {
119  return $this->participants;
120  }
121  return $this->participants = ilParticipants::getInstance($this->getParentObject()->getRefId());
122  }
static getInstance($a_ref_id)
Get instance by ref_id.
participants()
Show participant table, subscriber table, wating list table;.
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMemberTabName()

ilMembershipGUI::getMemberTabName ( )
protected

Get member tab name.

Returns
string

Definition at line 1058 of file class.ilMembershipGUI.php.

Referenced by addMemberTab().

1059  {
1060  return $this->lng->txt('members');
1061  }
+ Here is the caller graph for this function:

◆ getParentGUI()

◆ getParentObject()

ilMembershipGUI::getParentObject ( )

Get parent object.

Returns
ilObject

Definition at line 107 of file class.ilMembershipGUI.php.

References $repository_object.

Referenced by __construct(), addMemberTab(), assignFromWaitingList(), ilGroupMembershipGUI\assignMembers(), ilLearningSequenceMembershipGUI\assignMembers(), ilCourseMembershipGUI\assignMembers(), assignSubscribers(), checkPermissionBool(), ilSessionMembershipGUI\checkRbacOrPositionAccessBool(), checkRbacOrPositionAccessBool(), ilSessionMembershipGUI\deleteParticipants(), deleteParticipants(), ilCourseMembershipGUI\deleteParticipantsWithLinkedCourses(), editMember(), ilCourseMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilGroupMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilLearningSequenceMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), filterUserIdsByRbacOrPositionOfCurrentUser(), getDefaultCommand(), ilLearningSequenceMembershipGUI\getDefaultRole(), ilGroupMembershipGUI\getLocalTypeRole(), ilLearningSequenceMembershipGUI\getLocalTypeRole(), ilCourseMembershipGUI\getLocalTypeRole(), ilCourseMembershipGUI\getMailContextOptions(), ilSessionMembershipGUI\getMailContextOptions(), getMembersObject(), ilLearningSequenceMembershipGUI\getMembersObject(), ilSessionMembershipGUI\getMemberTabName(), ilCourseMembershipGUI\getPrintMemberData(), ilGroupMembershipGUI\initEditParticipantTableGUI(), ilLearningSequenceMembershipGUI\initEditParticipantTableGUI(), ilCourseMembershipGUI\initEditParticipantTableGUI(), ilSessionMembershipGUI\initParticipantTableGUI(), ilGroupMembershipGUI\initParticipantTableGUI(), ilLearningSequenceMembershipGUI\initParticipantTableGUI(), ilCourseMembershipGUI\initParticipantTableGUI(), ilSessionMembershipGUI\initSubscriberTable(), initSubscriberTable(), ilSessionMembershipGUI\initWaitingList(), ilGroupMembershipGUI\initWaitingList(), ilLearningSequenceMembershipGUI\initWaitingList(), ilCourseMembershipGUI\initWaitingList(), jump2UsersGallery(), membersMap(), parseWaitingListTable(), participants(), printForMembersOutput(), ilLearningSequenceMembershipGUI\readMemberData(), refuseFromList(), refuseSubscribers(), ilLearningSequenceMembershipGUI\setSubTabs(), setSubTabs(), ilCourseMembershipGUI\showDeleteParticipantsConfirmationWithLinkedCourses(), showMailToMemberToolbarButton(), showMemberExportToolbarButton(), ilSessionMembershipGUI\updateMembers(), updateParticipants(), and ilLearningSequenceMembershipGUI\updateParticipantsStatus().

108  {
110  }
+ Here is the caller graph for this function:

◆ initSubscriberTable()

ilMembershipGUI::initSubscriberTable ( )
protected
Returns

Definition at line 1177 of file class.ilMembershipGUI.php.

References getParentObject().

Referenced by parseSubscriberTable().

1178  {
1179  $subscriber = new \ilSubscriberTableGUI($this, $this->getParentObject(), true, true);
1180  $subscriber->setTitle($this->lng->txt('group_new_registrations'));
1181  return $subscriber;
1182  }
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jump2UsersGallery()

ilMembershipGUI::jump2UsersGallery ( )
protected

Definition at line 1685 of file class.ilMembershipGUI.php.

References $DIC, ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_enabledUserRelatedData(), ilPrivacySettings\_getInstance(), ilObjectLP\getInstance(), ilParticipants\getInstance(), getMembersObject(), and getParentObject().

1686  {
1687  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
1688  }
+ Here is the call graph for this function:

◆ mailMembersBtn()

ilMembershipGUI::mailMembersBtn ( )
protected

Mail to members view type $ilToolbar.

Definition at line 846 of file class.ilMembershipGUI.php.

References $DIC, $GLOBALS, and showMailToMemberToolbarButton().

847  {
848  global $DIC;
849 
850  $ilToolbar = $DIC['ilToolbar'];
851 
852  $this->showMailToMemberToolbarButton($GLOBALS['DIC']['ilToolbar'], 'mailMembersBtn');
853  }
showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
Show mail to member toolbar button.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ membersMap()

ilMembershipGUI::membersMap ( )
protected

Members map.

Definition at line 810 of file class.ilMembershipGUI.php.

References $DIC, $tpl, ilParticipants\getInstanceByObjId(), ilMapUtil\getMapGUI(), getParentObject(), and ilMapUtil\isActivated().

811  {
812  global $DIC;
813 
814  $tpl = $DIC['tpl'];
815  $this->activateSubTab($this->getParentObject()->getType() . "_members_map");
816  include_once("./Services/Maps/classes/class.ilMapUtil.php");
817  if (!ilMapUtil::isActivated() || !$this->getParentObject()->getEnableMap()) {
818  return;
819  }
820 
821  $map = ilMapUtil::getMapGUI();
822  $map->setMapId("course_map")
823  ->setWidth("700px")
824  ->setHeight("500px")
825  ->setLatitude($this->getParentObject()->getLatitude())
826  ->setLongitude($this->getParentObject()->getLongitude())
827  ->setZoom($this->getParentObject()->getLocationZoom())
828  ->setEnableTypeControl(true)
829  ->setEnableNavigationControl(true)
830  ->setEnableCentralMarker(true);
831 
832  include_once './Services/Membership/classes/class.ilParticipants.php';
833  $members = ilParticipants::getInstanceByObjId($this->getParentObject()->getId())->getParticipants();
834  foreach ((array) $members as $user_id) {
835  $map->addUserMarker($user_id);
836  }
837 
838  $tpl->setContent($map->getHTML());
839  $tpl->setLeftContent($map->getUserListHTML());
840  }
static getMapGUI()
Get an instance of the GUI class.
static isActivated()
Checks whether Map feature is activated.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
+ Here is the call graph for this function:

◆ parseSubscriberTable()

ilMembershipGUI::parseSubscriberTable ( )
protected

Parse table of subscription request.

Definition at line 1160 of file class.ilMembershipGUI.php.

References filterUserIdsByRbacOrPositionOfCurrentUser(), getMembersObject(), and initSubscriberTable().

Referenced by participants().

1161  {
1162  $subscribers = $this->getMembersObject()->getSubscribers();
1163  $filtered_subscribers = $this->filterUserIdsByRbacOrPositionOfCurrentUser($subscribers);
1164  if (!count($filtered_subscribers)) {
1165  return null;
1166  }
1167  $subscriber = $this->initSubscriberTable();
1168  $subscriber->readSubscriberData(
1169  $filtered_subscribers
1170  );
1171  return $subscriber;
1172  }
getMembersObject()
Get member object.
filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
Filter user ids by access.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseWaitingListTable()

ilMembershipGUI::parseWaitingListTable ( )
protected

Parse table of subscription request.

Returns
ilWaitingListTableGUI

Definition at line 1359 of file class.ilMembershipGUI.php.

References filterUserIdsByRbacOrPositionOfCurrentUser(), and getParentObject().

Referenced by participants().

1360  {
1361  $wait = $this->initWaitingList();
1362 
1363  $wait_users = $this->filterUserIdsByRbacOrPositionOfCurrentUser($wait->getUserIds());
1364  if (!count($wait_users)) {
1365  return null;
1366  }
1367 
1368  include_once './Services/Membership/classes/class.ilWaitingListTableGUI.php';
1369  $waiting_table = new ilWaitingListTableGUI($this, $this->getParentObject(), $wait);
1370  $waiting_table->setUserIds(
1371  $wait_users
1372  );
1373  $waiting_table->readUserData();
1374  $waiting_table->setTitle($this->lng->txt('crs_waiting_list'));
1375 
1376  return $waiting_table;
1377  }
GUI class for course/group waiting list.
getParentObject()
Get parent object.
filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
Filter user ids by access.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ participants()

ilMembershipGUI::participants ( )
protected

Show participant table, subscriber table, wating list table;.

Definition at line 400 of file class.ilMembershipGUI.php.

References getParentObject(), parseSubscriberTable(), parseWaitingListTable(), and showParticipantsToolbar().

Referenced by getMembersObject(), ilLearningSequenceMembershipGUI\getMembersObject(), participantsApplyFilter(), and participantsResetFilter().

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  }
parseWaitingListTable()
Parse table of subscription request.
GUI class for course/group subscriptions.
showParticipantsToolbar()
Show participants toolbar.
parseSubscriberTable()
Parse table of subscription request.
GUI class for course/group waiting list.
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ participantsApplyFilter()

ilMembershipGUI::participantsApplyFilter ( )
protected

Apply filter for participant table.

Definition at line 434 of file class.ilMembershipGUI.php.

References participants().

435  {
436  $table = $this->initParticipantTableGUI();
437  $table->resetOffset();
438  $table->writeFilterToSession();
439 
440  $this->participants();
441  }
participants()
Show participant table, subscriber table, wating list table;.
+ Here is the call graph for this function:

◆ participantsResetFilter()

ilMembershipGUI::participantsResetFilter ( )
protected

reset participants filter

Definition at line 446 of file class.ilMembershipGUI.php.

References participants().

447  {
448  $table = $this->initParticipantTableGUI();
449  $table->resetOffset();
450  $table->resetFilter();
451 
452  $this->participants();
453  }
participants()
Show participant table, subscriber table, wating list table;.
+ Here is the call graph for this function:

◆ printForMembersOutput()

ilMembershipGUI::printForMembersOutput ( )
protected

print members output

Definition at line 1659 of file class.ilMembershipGUI.php.

References $DIC, getMembersObject(), and getParentObject().

1660  {
1661  global $DIC;
1662 
1663  $tabs = $DIC->tabs();
1664  $tabs->clearTargets();
1665  $tabs->setBackTarget(
1666  $this->lng->txt('back'),
1667  $this->ctrl->getLinkTarget($this, 'jump2UsersGallery')
1668  );
1669 
1670  $list = $this->initAttendanceList();
1671  $list->setTitle($this->lng->txt('obj_' . $this->getParentObject()->getType()) . ': ' . $this->getParentObject()->getTitle());
1672  $list->setId(0);
1673  $form = $list->initForm('printForMembersOutput');
1674  $list->initFromForm();
1675  $list->setCallback(array($this, 'getAttendanceListUserData'));
1676  $this->member_data = $this->getPrintMemberData($this->getMembersObject()->getParticipants());
1677  $list->getNonMemberUserData($this->member_data);
1678 
1679  $list->getFullscreenHTML();
1680  }
getMembersObject()
Get member object.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
+ Here is the call graph for this function:

◆ printMembers()

ilMembershipGUI::printMembers ( )
protected

Print members.

Todo:
: refactor to own class

Definition at line 1609 of file class.ilMembershipGUI.php.

References $DIC, and checkPermission().

1610  {
1611  global $DIC;
1612 
1613  $ilTabs = $DIC['ilTabs'];
1614 
1615  $this->checkPermission('read');
1616 
1617  $ilTabs->clearTargets();
1618 
1619  $ilTabs->setBackTarget(
1620  $this->lng->txt('back'),
1621  $this->ctrl->getLinkTarget($this, 'participants')
1622  );
1623 
1624  $list = $this->initAttendanceList();
1625  $form = $list->initForm('printMembersOutput');
1626  $this->tpl->setContent($form->getHTML());
1627  }
checkPermission($a_permission, $a_cmd="")
Check permission If not granted redirect to parent gui.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ printMembersOutput()

ilMembershipGUI::printMembersOutput ( )
protected

print members output

Definition at line 1632 of file class.ilMembershipGUI.php.

References $DIC, filterUserIdsByRbacOrPositionOfCurrentUser(), and getMembersObject().

1633  {
1634  global $DIC;
1635 
1636  $tabs = $DIC->tabs();
1637  $tabs->clearTargets();
1638  $tabs->setBackTarget(
1639  $this->lng->txt('back'),
1640  $this->ctrl->getLinkTarget($this, 'participants')
1641  );
1642 
1643  $list = $this->initAttendanceList();
1644  $list->initFromForm();
1645  $list->setCallback(array($this, 'getAttendanceListUserData'));
1646  $this->member_data = $this->getPrintMemberData(
1648  $this->getMembersObject()->getParticipants()
1649  )
1650  );
1651 
1652  $list->getNonMemberUserData($this->member_data);
1653  $list->getFullscreenHTML();
1654  }
getMembersObject()
Get member object.
$DIC
Definition: xapitoken.php:46
filterUserIdsByRbacOrPositionOfCurrentUser($a_user_ids)
Filter user ids by access.
+ Here is the call graph for this function:

◆ readMemberData()

ilMembershipGUI::readMemberData ( array  $usr_ids,
array  $columns 
)

Required for member table guis.

Has to be refactored and should be locate in ilObjCourse, ilObjGroup instead of GUI

Returns
array

Definition at line 1143 of file class.ilMembershipGUI.php.

References getParentGUI().

Referenced by ilGroupMembershipGUI\getPrintMemberData(), ilGroupMembershipGUI\initEditParticipantTableGUI(), and ilCourseMembershipGUI\initEditParticipantTableGUI().

1144  {
1145  return $this->getParentGUI()->readMemberData($usr_ids, $columns);
1146  }
getParentGUI()
Get parent gui.
if(! $in) $columns
Definition: Utf8Test.php:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refuseFromList()

ilMembershipGUI::refuseFromList ( )
protected

refuse from waiting list

public

Returns

Definition at line 1517 of file class.ilMembershipGUI.php.

References $_POST, getMembersObject(), getParentObject(), ilUtil\sendFailure(), ilSessionMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER, and ilGroupMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER.

1518  {
1519  if (!array_key_exists('waiting', $_POST) || !count($_POST['waiting'])) {
1520  ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
1521  $this->ctrl->redirect($this, 'participants');
1522  }
1523 
1524  $waiting_list = $this->initWaitingList();
1525 
1526  foreach ($_POST["waiting"] as $user_id) {
1527  $waiting_list->removeFromList($user_id);
1528 
1529  if ($this instanceof ilCourseMembershipGUI) {
1530  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $user_id, true);
1531  }
1532  if ($this instanceof ilGroupMembershipGUI) {
1533  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1534  $this->getMembersObject()->sendNotification(
1536  $user_id,
1537  true
1538  );
1539  }
1540  if ($this instanceof ilSessionMembershipGUI) {
1541  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
1543  $noti->setRefId($this->getParentObject()->getRefId());
1544  $noti->setRecipients(array($user_id));
1546  $noti->send();
1547  }
1548  }
1549  ilUtil::sendSuccess($this->lng->txt('crs_users_removed_from_list'), true);
1550  $this->ctrl->redirect($this, 'participants');
1551  }
getMembersObject()
Get member object.
GUI class for membership features.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
getParentObject()
Get parent object.
$_POST["username"]
+ Here is the call graph for this function:

◆ refuseSubscribers()

ilMembershipGUI::refuseSubscribers ( )
protected

Refuse subscribers type $rbacsystem.

Returns
boolean

Definition at line 1261 of file class.ilMembershipGUI.php.

References $_POST, $DIC, $GLOBALS, getMembersObject(), getParentObject(), ilUtil\sendFailure(), ilLearningSequenceMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER, ilSessionMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER, and ilGroupMembershipMailNotification\TYPE_REFUSED_SUBSCRIPTION_MEMBER.

1262  {
1263  global $DIC;
1264 
1265  $rbacsystem = $DIC['rbacsystem'];
1266 
1267  if (!$_POST['subscribers']) {
1268  ilUtil::sendFailure($this->lng->txt("crs_no_subscribers_selected"), true);
1269  $this->ctrl->redirect($this, 'participants');
1270  }
1271 
1272  if (!$this->getMembersObject()->deleteSubscribers($_POST["subscribers"])) {
1273  ilUtil::sendFailure($GLOBALS['DIC']['ilErr']->getMessage(), true);
1274  $this->ctrl->redirect($this, 'participants');
1275  } else {
1276  foreach ($_POST['subscribers'] as $usr_id) {
1277  if ($this instanceof ilCourseMembershipGUI) {
1278  $this->getMembersObject()->sendNotification($this->getMembersObject()->NOTIFY_DISMISS_SUBSCRIBER, $usr_id);
1279  }
1280  if ($this instanceof ilGroupMembershipGUI) {
1281  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1282  $this->getMembersObject()->sendNotification(
1284  $usr_id
1285  );
1286  }
1287  if ($this instanceof ilSessionMembershipGUI) {
1289  $noti->setRefId($this->getParentObject()->getRefId());
1290  $noti->setRecipients(array($usr_id));
1292  $noti->send();
1293  }
1294  if ($this instanceof ilLearningSequenceMembershipGUI) {
1295  $this->getMembersObject()->sendNotification(
1297  $usr_id
1298  );
1299  }
1300  }
1301  }
1302 
1303  ilUtil::sendSuccess($this->lng->txt("crs_subscribers_deleted"), true);
1304  $this->ctrl->redirect($this, 'participants');
1305  }
getMembersObject()
Get member object.
GUI class for membership features.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
GUI class for membership features.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
$_POST["username"]
GUI class for learning sequence membership features.
+ Here is the call graph for this function:

◆ sendMailToSelectedUsers()

ilMembershipGUI::sendMailToSelectedUsers ( )
protected

Send mail to selected users.

Definition at line 756 of file class.ilMembershipGUI.php.

References $_GET, $_POST, ilObjUser\_lookupLogin(), createMailSignature(), getMailContextOptions(), ilMailFormCall\getRedirectTarget(), ilUtil\redirect(), ilUtil\sendFailure(), and ilMailFormCall\setRecipients().

757  {
758  $participants = [];
759  if ($_POST['participants']) {
760  $participants = (array) $_POST['participants'];
761  } elseif ($_GET['member_id']) {
762  $participants = array($_GET['member_id']);
763  } elseif ($_POST['subscribers']) {
764  $participants = (array) $_POST['subscribers'];
765  } elseif ($_POST['waiting']) {
766  $participants = (array) $_POST['waiting'];
767  }
768 
769  if (!count($participants)) {
770  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
771  $this->ctrl->redirect($this, 'participants');
772  }
773 
774  foreach ($participants as $usr_id) {
775  $rcps[] = ilObjUser::_lookupLogin($usr_id);
776  }
777 
778 
779  $context_options = $this->getMailContextOptions();
780 
784  $this,
785  'participants',
786  array(),
787  array(
788  'type' => 'new',
789  'sig' => $this->createMailSignature()
790  ),
791  $context_options
792  )
793  );
794  }
static _lookupLogin($a_user_id)
lookup login
$_GET["client_id"]
getMailContextOptions()
Get mail context options.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getRedirectTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
static setRecipients(array $recipients)
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:

◆ setSubTabs()

ilMembershipGUI::setSubTabs ( ilTabsGUI  $tabs)
protected

Set sub tabs.

Definition at line 1066 of file class.ilMembershipGUI.php.

References $DIC, ilPrivacySettings\_getInstance(), ilTabsGUI\addSubTabTarget(), checkRbacOrPositionAccessBool(), getParentObject(), and ilMapUtil\isActivated().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

1067  {
1068  global $DIC;
1069 
1070  $ilAccess = $DIC['ilAccess'];
1071 
1072  if ($this->checkRbacOrPositionAccessBool('manage_members', 'manage_members', $this->getParentObject()->getRefId())) {
1073  $tabs->addSubTabTarget(
1074  $this->getParentObject()->getType() . "_member_administration",
1075  $this->ctrl->getLinkTarget($this, 'participants'),
1076  "members",
1077  get_class($this)
1078  );
1079 
1080  // show group overview
1081  if ($this instanceof ilCourseMembershipGUI) {
1082  $tabs->addSubTabTarget(
1083  "crs_members_groups",
1084  $this->ctrl->getLinkTargetByClass("ilCourseParticipantsGroupsGUI", "show"),
1085  "",
1086  "ilCourseParticipantsGroupsGUI"
1087  );
1088  }
1089 
1090  $tree = $DIC->repositoryTree();
1091  $children = (array) $tree->getSubTree($tree->getNodeData($this->getParentObject()->getRefId()), false, 'sess');
1092  if (count($children)) {
1093  $tabs->addSubTabTarget(
1094  'events',
1095  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilsessionoverviewgui'), 'listSessions'),
1096  '',
1097  'ilsessionoverviewgui'
1098  );
1099  }
1100 
1101  $tabs->addSubTabTarget(
1102  $this->getParentObject()->getType() . '_members_gallery',
1103  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1104  'view',
1105  'ilUsersGalleryGUI'
1106  );
1107  } elseif ($this->getParentObject()->getShowMembers()) {
1108  // gallery
1109  $tabs->addSubTabTarget(
1110  $this->getParentObject()->getType() . '_members_gallery',
1111  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilUsersGalleryGUI')),
1112  'view',
1113  'ilUsersGalleryGUI'
1114  );
1115  }
1116 
1117  include_once './Services/Maps/classes/class.ilMapUtil.php';
1118  if (ilMapUtil::isActivated() && $this->getParentObject()->getEnableMap()) {
1119  $tabs->addSubTabTarget(
1120  $this->getParentObject()->getType() . '_members_map',
1121  $this->ctrl->getLinkTarget($this, 'membersMap'),
1122  "membersMap",
1123  get_class($this)
1124  );
1125  }
1126 
1127  include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
1128  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->getRefId())) {
1129  $tabs->addSubTabTarget(
1130  'export_members',
1131  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilmemberexportgui'), 'show'),
1132  '',
1133  'ilmemberexportgui'
1134  );
1135  }
1136  }
addSubTabTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
static isActivated()
Checks whether Map feature is activated.
$DIC
Definition: xapitoken.php:46
static _getInstance()
Get instance of ilPrivacySettings.
getParentObject()
Get parent object.
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
Check if rbac or position access is granted.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMailToMemberToolbarButton()

ilMembershipGUI::showMailToMemberToolbarButton ( ilToolbarGUI  $toolbar,
  $a_back_cmd = null,
  $a_separator = false 
)
protected

Show mail to member toolbar button.

Definition at line 937 of file class.ilMembershipGUI.php.

References $DIC, $ilUser, ilToolbarGUI\addButton(), ilToolbarGUI\addSeparator(), and getParentObject().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser(), mailMembersBtn(), ilLearningSequenceMembershipGUI\showParticipantsToolbar(), and showParticipantsToolbar().

938  {
939  global $DIC;
940 
941  $ilUser = $DIC['ilUser'];
942  $rbacsystem = $DIC['rbacsystem'];
943  $ilAccess = $DIC['ilAccess'];
944  include_once 'Services/Mail/classes/class.ilMail.php';
945  $mail = new ilMail($ilUser->getId());
946 
947  if (
948  ($this->getParentObject()->getMailToMembersType() == 1) ||
949  (
950  $ilAccess->checkAccess('manage_members', "", $this->getParentObject()->getRefId()) &&
951  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())
952  )
953  ) {
954  if ($a_separator) {
955  $toolbar->addSeparator();
956  }
957 
958  if ($a_back_cmd) {
959  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
960  }
961 
962  $toolbar->addButton(
963  $this->lng->txt("mail_members"),
964  $this->ctrl->getLinkTargetByClass('ilMailMemberSearchGUI', '')
965  );
966  }
967  }
$ilUser
Definition: imgupload.php:18
addSeparator()
Add separator.
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMemberExportToolbarButton()

ilMembershipGUI::showMemberExportToolbarButton ( ilToolbarGUI  $toolbar,
  $a_back_cmd = null,
  $a_separator = false 
)
protected

Show member export button.

Parameters
ilToolbarGUI$toolbar
type$a_back_cmd
type$a_separator

Definition at line 911 of file class.ilMembershipGUI.php.

References ilToolbarGUI\addButton(), ilToolbarGUI\addSeparator(), and getParentObject().

Referenced by filterUserIdsByRbacOrPositionOfCurrentUser().

912  {
913  if (
914  $this->getParentObject()->getType() == 'crs' &&
915  $this->getParentObject()->getShowMembersExport()) {
916  if ($a_separator) {
917  $toolbar->addSeparator();
918  }
919 
920  if ($a_back_cmd) {
921  $this->ctrl->setParameter($this, "back_cmd", $a_back_cmd);
922  }
923  $toolbar->addButton(
924  $this->lng->txt($this->getParentObject()->getType() . '_print_list'),
925  $this->ctrl->getLinkTarget($this, 'printForMembersOutput')
926  );
927  }
928  }
addSeparator()
Add separator.
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
getParentObject()
Get parent object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showParticipantsToolbar()

ilMembershipGUI::showParticipantsToolbar ( )
protected

Show participants toolbar.

Definition at line 861 of file class.ilMembershipGUI.php.

References $DIC, canAddOrSearchUsers(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), getDefaultRole(), getParentGUI(), and showMailToMemberToolbarButton().

Referenced by participants().

862  {
863  global $DIC;
864 
865  $ilToolbar = $DIC['ilToolbar'];
866 
867  if ($this->canAddOrSearchUsers()) {
868  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
870  $this,
871  $ilToolbar,
872  array(
873  'auto_complete_name' => $this->lng->txt('user'),
874  'user_type' => $this->getParentGUI()->getLocalRoles(),
875  'user_type_default' => $this->getDefaultRole(),
876  'submit_name' => $this->lng->txt('add')
877  )
878  );
879 
880  // spacer
881  $ilToolbar->addSeparator();
882 
883  // search button
884  $ilToolbar->addButton(
885  $this->lng->txt($this->getParentObject()->getType() . "_search_users"),
886  $this->ctrl->getLinkTargetByClass(
887  'ilRepositorySearchGUI',
888  'start'
889  )
890  );
891 
892  // separator
893  $ilToolbar->addSeparator();
894  }
895 
896  // print button
897  $ilToolbar->addButton(
898  $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
899  $this->ctrl->getLinkTarget($this, 'printMembers')
900  );
901 
902  $this->showMailToMemberToolbarButton($ilToolbar, 'participants', false);
903  }
showMailToMemberToolbarButton(ilToolbarGUI $toolbar, $a_back_cmd=null, $a_separator=false)
Show mail to member toolbar button.
getParentGUI()
Get parent gui.
$DIC
Definition: xapitoken.php:46
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
canAddOrSearchUsers()
Check if current user is allowed to add / search users.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateParticipants()

ilMembershipGUI::updateParticipants ( )

update members

public

Parameters

Definition at line 494 of file class.ilMembershipGUI.php.

References $_POST, $DIC, $ilUser, getMembersObject(), getParentObject(), and ilUtil\sendFailure().

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  }
getMembersObject()
Get member object.
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
getParentObject()
Get parent object.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilMembershipGUI::$access
protected

◆ $ctrl

ilMembershipGUI::$ctrl = null
protected

◆ $lng

ilMembershipGUI::$lng = null
protected

◆ $logger

ilMembershipGUI::$logger = null
protected

Definition at line 36 of file class.ilMembershipGUI.php.

Referenced by getLogger().

◆ $repository_gui

ilMembershipGUI::$repository_gui = null
private

Definition at line 21 of file class.ilMembershipGUI.php.

Referenced by __construct(), and getParentGUI().

◆ $repository_object

ilMembershipGUI::$repository_object = null
private

Definition at line 16 of file class.ilMembershipGUI.php.

Referenced by getParentObject().

◆ $tpl

ilMembershipGUI::$tpl
protected

Definition at line 41 of file class.ilMembershipGUI.php.

Referenced by membersMap().


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