19declare(strict_types=1);
36 protected ilUIServices $ui_services,
43 protected function applyFilter(
46 if (is_null($filter_data)) {
47 return $this->data[
'rows'] ?? [];
55 $group_ids = is_null($select->getValue()) ? [] : [(
int) $select->getValue()];
56 $group_ids = array_diff($group_ids, [0]);
57 $name =
$text->getValue() ??
'';
59 foreach ($this->data[
'rows'] ?? [] as $row) {
61 foreach ($row[
'groups'] as $group) {
62 $row_group_ids[] = $group[
'group_id'];
65 !$select->isDisabled() &&
66 count($group_ids) > 0 &&
67 count(array_diff($group_ids, $row_group_ids)) === count($group_ids)
72 !
$text->isDisabled() &&
74 !str_contains($row[
'name'], $name)
86 return $group_ref_id . self::TABLE_ACTION_CONFIRM_UNSUBSCRIBE_SUFFIX;
92 return $group_ref_id . self::TABLE_ACTION_UNSUBSCRIBE_SUFFIX;
98 foreach ($this->getSelectableGroups() as
$ref_id => $group) {
99 $ids[] = $this->buildConfirmUnsubscribeActionId(
$ref_id);
108 foreach ($this->data[
'rows'] ?? [] as $row) {
109 $ids[] = (
int) $row[
'usr_id'];
116 $selectable_group_ids = [];
117 foreach ($this->data[
'groups'] ?? [] as
$ref_id => $something) {
118 if ($this->data[
'groups_rights'][
$ref_id][
'manage_members']) {
122 return $selectable_group_ids;
127 array $visible_column_ids,
129 \
ILIAS\Data\Order $order,
130 mixed $additional_viewcontrol_data,
132 mixed $additional_parameters
134 [$column_name, $direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
135 $rows = $this->applyFilter($filter_data);
136 $groups_rights = $this->data[
'groups_rights'] ?? [];
137 $comparator =
function (array $f1, array $f2) {
140 switch ($column_name) {
142 $comparator =
function (array $f1, array $f2) {
143 return strcmp($f1[
'name'], $f2[
'name']);
147 $comparator =
function (array $f1, array $f2) {
148 return strcmp($f1[
'login'], $f2[
'login']);
152 $comparator =
function (array $f1, array $f2) {
153 if ($f1[
'groups_number'] === $f2[
'groups_number']) {
156 return $f1[
'groups_number'] > $f2[
'groups_number'] ? 1 : -1;
160 $comparator =
function (array $f1, array $f2) {
161 return strcmp($f1[
'group_info'][
'title'], $f2[
'group_info'][
'title']);
165 uasort($rows, $comparator);
166 if ($direction ===
"DESC") {
167 $rows = array_reverse($rows,
true);
170 foreach ($rows as $row) {
172 $enabled_actions = [];
173 foreach ($row[
'groups'] as $group_info) {
174 $grp_id = $group_info[
'group_id'];
175 $role = $group_info[
'role'];
176 $title = $group_info[
'title'];
178 !($role ==
'admin' && $groups_rights[$grp_id][
'edit_permission']) &&
179 !($role ==
'member' && $groups_rights[$grp_id][
'manage_members'])
183 $groups_str .= ($groups_str ===
'' ? $title :
'<br>' . $title);
184 $enabled_actions[] = $this->buildConfirmUnsubscribeActionId($grp_id);
186 $data_row = $row_builder->buildDataRow(
195 $disabled_actions = array_diff($this->getAllConfirmUnsubscribeActionIds(), $enabled_actions);
196 foreach ($disabled_actions as $disabled_action) {
197 $data_row = $data_row->withDisabledAction($disabled_action,
true);
204 mixed $additional_viewcontrol_data,
206 mixed $additional_parameters
208 return count($this->applyFilter($filter_data));
213 $parent_node = $this->tree->getNodeData($this->ref_id);
214 $groups = $this->tree->getSubTree($parent_node,
true, [
'grp']);
216 !is_array($groups) ||
221 $results_participants = [];
222 $results_groups = [];
223 $results_groups_rights = [];
224 foreach ($groups as $idx => $group_data) {
225 # check for group in group
227 $group_data[
'parent'] != $this->ref_id &&
228 $this->tree->checkForParentType(
229 $group_data[
'ref_id'],
234 unset($groups[$idx]);
237 $results_groups[$group_data[
'ref_id']] = $group_data[
'title'];
238 $results_groups_rights[$group_data[
'ref_id']][
'manage_members'] = $this->
access->checkRbacOrPositionPermissionAccess(
241 $group_data[
'ref_id']
243 $results_groups_rights[$group_data[
'ref_id']][
'edit_permission'] = $this->
access->checkAccess(
246 $group_data[
'ref_id']
249 $members = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
252 $group_data[
'ref_id'],
255 $admins = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
258 $group_data[
'ref_id'],
261 $results_participants[$group_data[
'ref_id']][
'members'] = $members;
262 $results_participants[$group_data[
'ref_id']][
'admins'] = $admins;
265 $members = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
271 if ($members === []) {
275 foreach ($members as $usr_id) {
277 $membership_count = 0;
280 'name' => $name[
'lastname'] .
', ' . $name[
'firstname'],
282 'login' => $name[
'login']
284 foreach (array_keys($results_participants) as $group_id) {
286 'group_id' => $group_id,
287 'title' => $results_groups[$group_id],
290 if (in_array($usr_id, $results_participants[$group_id][
'members'])) {
291 $group_info[
'role'] =
'member';
293 if (in_array($usr_id, $results_participants[$group_id][
'admins'])) {
294 $group_info[
'role'] =
'admin';
296 if ($group_info[
'role'] ===
'') {
299 $new_entry[
'groups'][] = $group_info;
302 $new_entry[
'groups_number'] = $membership_count;
303 $usr_data[] = $new_entry;
305 $this->data[
'rows'] = $usr_data;
306 $this->data[
'groups'] = $results_groups;
307 $this->data[
'groups_rights'] = $results_groups_rights;
Provides fluid interface to RBAC services.
Class ilAccessHandler Checks access for ILIAS objects.
Class ilCourseParticipantsGroupsGUI.
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getAllConfirmUnsubscribeActionIds()
const string TABLE_ACTION_CONFIRM_UNSUBSCRIBE_SUFFIX
buildConfirmUnsubscribeActionId(int $group_ref_id)
buildUnsubscribeActionId(int $group_ref_id)
__construct(protected ilCourseParticipantsGroupsGUI $parent_obj, protected ilTree $tree, protected ilAccess $access, protected ilUIServices $ui_services, protected int $ref_id)
const string TABLE_ACTION_UNSUBSCRIBE_SUFFIX
getRows(\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, \ILIAS\Data\Range $range, \ILIAS\Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
const string TABLE_FILTER_NAME
const string TABLE_COL_NAME
const string TABLE_FILTER_GROUPS
const string TABLE_COL_LOGIN
const string TABLE_COL_GROUPS
const string TABLE_COL_GROUP_NUMBER
static _getInstanceByObjId(int $a_obj_id)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
static _lookupName(int $a_user_id)
static _lookupObjId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))