ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseParticipantsGroupsGUI Class Reference

Class ilCourseParticipantsGroupsGUI. More...

+ Collaboration diagram for ilCourseParticipantsGroupsGUI:

Public Member Functions

 __construct ($a_ref_id)
 
 executeCommand ()
 
 show ()
 
 applyFilter ()
 
 resetFilter ()
 
 confirmRemove ()
 

Protected Member Functions

 remove ()
 
 getMultiCommandGroupID ()
 
 add ()
 

Protected Attributes

ilAccessHandler $access
 
ilLanguage $lng
 
ilCtrlInterface $ctrl
 
ilErrorHandling $error
 
ilGlobalTemplateInterface $tpl
 
ilObjectDataCache $objectDataCache
 
GlobalHttpState $http
 
Factory $refinery
 

Private Attributes

int $ref_id = 0
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCourseParticipantsGroupsGUI::__construct (   $a_ref_id)

Definition at line 42 of file class.ilCourseParticipantsGroupsGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

43  {
44  global $DIC;
45 
46  $this->access = $DIC->access();
47  $this->ctrl = $DIC->ctrl();
48  $this->lng = $DIC->language();
49  $this->error = $DIC['ilErr'];
50  $this->tpl = $DIC->ui()->mainTemplate();
51  $this->objectDataCache = $DIC['ilObjDataCache'];
52  $this->http = $DIC->http();
53  $this->refinery = $DIC->refinery();
54 
55  $this->ref_id = $a_ref_id;
56  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilCourseParticipantsGroupsGUI::add ( )
protected

Definition at line 184 of file class.ilCourseParticipantsGroupsGUI.php.

References $message, ilGroupParticipants\_getInstanceByObjId(), ILIAS\Repository\access(), getMultiCommandGroupID(), ILIAS\FileDelivery\http(), ilParticipants\IL_GRP_MEMBER, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), show(), and ilGroupMembershipMailNotification\TYPE_ADMISSION_MEMBER.

184  : void
185  {
186  $grp_id = $this->getMultiCommandGroupID();
187  $usr_ids = [];
188  if ($this->http->wrapper()->post()->has('usrs')) {
189  $usr_ids = $this->http->wrapper()->post()->retrieve(
190  'usrs',
191  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->int())
192  );
193  }
194 
195  if (count($usr_ids) > 0) {
196  if (!$this->access->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $grp_id)) {
197  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
198  $this->show();
199  return;
200  }
201 
202  $members_obj = ilGroupParticipants::_getInstanceByObjId($this->objectDataCache->lookupObjId($grp_id));
203  $rejected_count = 0;
204  foreach ($usr_ids as $new_member) {
205  if (!$members_obj->add($new_member, ilParticipants::IL_GRP_MEMBER)) {
206  $rejected_count++;
207  continue;
208  }
209 
210  $members_obj->sendNotification(
212  $new_member
213  );
214  }
215 
216  if ($rejected_count === 0) {
217  $message = $this->lng->txt('grp_msg_member_assigned');
218  } else {
219  $accepted_count = count($usr_ids) - $rejected_count;
220  $message = sprintf(
221  $this->lng->txt('grp_not_all_users_assigned_msg'),
222  $accepted_count,
223  $rejected_count
224  );
225  }
226  $this->tpl->setOnScreenMessage('success', $message);
227  }
228  $this->show();
229  }
static http()
Fetches the global http state from ILIAS.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:

◆ applyFilter()

ilCourseParticipantsGroupsGUI::applyFilter ( )

Definition at line 76 of file class.ilCourseParticipantsGroupsGUI.php.

References show().

76  : void
77  {
78  $tbl_gui = new ilCourseParticipantsGroupsTableGUI($this, "show", $this->ref_id);
79  $tbl_gui->resetOffset();
80  $tbl_gui->writeFilterToSession();
81  $this->show();
82  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ confirmRemove()

ilCourseParticipantsGroupsGUI::confirmRemove ( )

Definition at line 92 of file class.ilCourseParticipantsGroupsGUI.php.

References ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilUserUtil\getNamePresentation(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

92  : void
93  {
94  $grp_id = 0;
95  if ($this->http->wrapper()->query()->has('grp_id')) {
96  $grp_id = $this->http->wrapper()->query()->retrieve(
97  'grp_id',
98  $this->refinery->kindlyTo()->int()
99  );
100  }
101  $confirm = new ilConfirmationGUI();
102  $confirm->setFormAction($this->ctrl->getFormAction($this, 'remove'));
103  $confirm->addHiddenItem("grp_id", $grp_id);
104  $confirm->setHeaderText($this->lng->txt('grp_dismiss_member'));
105  $confirm->setConfirm($this->lng->txt('confirm'), 'remove');
106  $confirm->setCancel($this->lng->txt('cancel'), 'show');
107 
108  $usr_id = 0;
109  if ($this->http->wrapper()->query()->has('usr_id')) {
110  $usr_id = $this->http->wrapper()->query()->retrieve(
111  'usr_id',
112  $this->refinery->kindlyTo()->int()
113  );
114  }
115  $confirm->addItem(
116  'usr_id',
117  $usr_id,
118  ilUserUtil::getNamePresentation($usr_id, false, false, "", true),
119  ilUtil::getImagePath('icon_usr.svg')
120  );
121 
122  $this->tpl->setContent($confirm->getHTML());
123  }
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ executeCommand()

ilCourseParticipantsGroupsGUI::executeCommand ( )

Definition at line 58 of file class.ilCourseParticipantsGroupsGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

58  : void
59  {
60  if (!$this->access->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $this->ref_id)) {
61  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
62  }
63  $cmd = $this->ctrl->getCmd();
64  if (!$cmd) {
65  $cmd = "show";
66  }
67  $this->$cmd();
68  }
+ Here is the call graph for this function:

◆ getMultiCommandGroupID()

ilCourseParticipantsGroupsGUI::getMultiCommandGroupID ( )
protected

Definition at line 160 of file class.ilCourseParticipantsGroupsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by add().

160  : int
161  {
162  $grp_id = 0;
163  $table_command = '';
164  if (
165  $this->http->wrapper()->post()->has('cmd') &&
166  $this->http->wrapper()->post()->has('grp_id')
167  ) {
168  $grp_id = $this->http->wrapper()->post()->retrieve(
169  'grp_id',
170  $this->refinery->kindlyTo()->int()
171  );
172  } elseif (
173  $this->http->wrapper()->post()->has('table_top_cmd') &&
174  $this->http->wrapper()->post()->has('grp_id_2')
175  ) {
176  $grp_id = $this->http->wrapper()->post()->retrieve(
177  'grp_id_2',
178  $this->refinery->kindlyTo()->int()
179  );
180  }
181  return $grp_id;
182  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

ilCourseParticipantsGroupsGUI::remove ( )
protected

Definition at line 125 of file class.ilCourseParticipantsGroupsGUI.php.

References ilGroupParticipants\_getInstanceByObjId(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), show(), and ilGroupMembershipMailNotification\TYPE_DISMISS_MEMBER.

125  : void
126  {
127  $grp_id = 0;
128  if ($this->http->wrapper()->post()->has('grp_id')) {
129  $grp_id = $this->http->wrapper()->post()->retrieve(
130  'grp_id',
131  $this->refinery->kindlyTo()->int()
132  );
133  }
134  $usr_id = 0;
135  if ($this->http->wrapper()->post()->has('usr_id')) {
136  $usr_id = $this->http->wrapper()->post()->retrieve(
137  'usr_id',
138  $this->refinery->kindlyTo()->int()
139  );
140  }
141  if (!$this->access->checkRbacOrPositionPermissionAccess('manage_members', 'manage_members', $grp_id)) {
142  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
143  $this->show();
144  return;
145  }
146 
147  $members_obj = ilGroupParticipants::_getInstanceByObjId($this->objectDataCache->lookupObjId($grp_id));
148  $members_obj->delete($usr_id);
149 
150  // Send notification
151  $members_obj->sendNotification(
153  (int) $usr_id
154  );
155 
156  $this->tpl->setOnScreenMessage('success', $this->lng->txt("grp_msg_membership_annulled"), true);
157  $this->ctrl->redirect($this, "show");
158  }
static http()
Fetches the global http state from ILIAS.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

◆ resetFilter()

ilCourseParticipantsGroupsGUI::resetFilter ( )

Definition at line 84 of file class.ilCourseParticipantsGroupsGUI.php.

References show().

84  : void
85  {
86  $tbl_gui = new ilCourseParticipantsGroupsTableGUI($this, "show", $this->ref_id);
87  $tbl_gui->resetOffset();
88  $tbl_gui->resetFilter();
89  $this->show();
90  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ show()

ilCourseParticipantsGroupsGUI::show ( )

Definition at line 70 of file class.ilCourseParticipantsGroupsGUI.php.

Referenced by add(), applyFilter(), remove(), and resetFilter().

70  : void
71  {
72  $tbl_gui = new ilCourseParticipantsGroupsTableGUI($this, "show", $this->ref_id);
73  $this->tpl->setContent($tbl_gui->getHTML());
74  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCourseParticipantsGroupsGUI::$access
protected

Definition at line 33 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $ctrl

ilCtrlInterface ilCourseParticipantsGroupsGUI::$ctrl
protected

Definition at line 35 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $error

ilErrorHandling ilCourseParticipantsGroupsGUI::$error
protected

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

◆ $http

GlobalHttpState ilCourseParticipantsGroupsGUI::$http
protected

Definition at line 39 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $lng

ilLanguage ilCourseParticipantsGroupsGUI::$lng
protected

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

◆ $objectDataCache

ilObjectDataCache ilCourseParticipantsGroupsGUI::$objectDataCache
protected

Definition at line 38 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $ref_id

int ilCourseParticipantsGroupsGUI::$ref_id = 0
private

Definition at line 31 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $refinery

Factory ilCourseParticipantsGroupsGUI::$refinery
protected

Definition at line 40 of file class.ilCourseParticipantsGroupsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilCourseParticipantsGroupsGUI::$tpl
protected

Definition at line 37 of file class.ilCourseParticipantsGroupsGUI.php.


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