19 declare(strict_types=1);
71 private readonly
string $action
80 array $visible_column_ids,
84 ?array $additional_parameters,
86 $records = $this->
getRecords($range, $order, $filter_data);
87 foreach ($records as $record) {
88 yield $row_builder->buildDataRow((
string) $record[
'user_id'], $record);
97 if ($this->records ===
null) {
115 if (!isset($this->table_component)) {
116 $query_params_namespace = [
'frm',
'notifications',
'table'];
119 [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
120 $query_params_namespace,
125 $this->table_component = $this->ui_factory->table()
132 $this->ui_service->filter()->getData(
139 $action_parameter_token,
143 ->withId(
'forum_notification_table')
144 ->withRequest($this->http_request);
152 if (!isset($this->filter_component)) {
154 $is_input_initially_rendered = [];
155 $field_factory = $this->ui_factory->input()->field();
157 foreach ($this->
getFilterFields($field_factory) as $filter_id => $filter) {
158 [$filter_inputs[$filter_id], $is_input_initially_rendered[$filter_id]] = $filter;
161 $this->filter_component = $this->ui_service->filter()->standard(
162 'forum_notification_filter',
165 $is_input_initially_rendered,
180 'member' => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_member'),
181 'tutor' => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_tutor'),
182 'admin' => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_admin'),
183 'moderators' => $this->
lng->txt(
'frm_moderators'),
188 $field_factory->
select($this->
lng->txt(
'roles'), $options),
201 return \count((array) $this->records);
212 $admin_ids = $this->participants->getAdmins();
213 $member_ids = $this->participants->getMembers();
214 $tutor_ids = $this->participants->getTutors();
216 $filter = (string) ($filter_data[
'role'] ??
'');
219 $user_ids = $member_ids;
223 $user_ids = $tutor_ids;
227 $user_ids = $admin_ids;
231 $user_ids = $moderator_ids;
235 $user_ids = array_merge($admin_ids, $member_ids, $tutor_ids, $moderator_ids);
239 return array_unique($user_ids);
283 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_ok.svg',
'',
'small'),
284 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_not_ok.svg',
'',
'small'),
291 $forced_events = $this->forumNotificationObj->getForcedEventsObjectByUserId($user_id);
292 $member_const =
'IL_' . strtoupper($this->participants->getType()) .
'_MEMBER';
293 $tutor_const =
'IL_' . strtoupper($this->participants->getType()) .
'_TUTOR';
294 $admin_const =
'IL_' . strtoupper($this->participants->getType()) .
'_ADMIN';
295 $member_id = $this->participants->getAutoGeneratedRoleId(
ilParticipants::{$member_const});
296 $tutor_id = $this->participants->getAutoGeneratedRoleId(
ilParticipants::{$tutor_const});
297 $admin_id = $this->participants->getAutoGeneratedRoleId(
ilParticipants::{$admin_const});
299 $types = implode(
', ',
array_map(
function (
int $role_id) use ($admin_id, $tutor_id, $member_id) {
300 return match ($role_id) {
301 $member_id => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_member'),
302 $tutor_id => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_tutor'),
303 $admin_id => $this->
lng->txt(
'il_' . $this->participants->getType() .
'_admin'),
306 }, $this->participants->getAssignedRoles($user_id)));
307 if (\in_array($user_id, $moderator_ids,
true)) {
308 $types .=
', ' . $this->
lng->txt(
'frm_moderators');
311 $users[$counter][
'user_id'] =
$user_id;
314 $users[$counter][
'firstname'] = $name[
'firstname'];
315 $users[$counter][
'lastname'] = $name[
'lastname'];
316 $users[$counter][
'user_toggle_noti'] = $icons[(
int) $forced_events->getUserToggle()];
317 $users[$counter][
'role'] = $types;
334 'enableHideUserToggleNoti' => $this->ui_factory->table()->action()->multi(
335 $this->
lng->txt(
'enable_hide_user_toggle'),
336 $url_builder->
withParameter($action_parameter_token,
'enableHideUserToggleNoti'),
339 'disableHideUserToggleNoti' => $this->ui_factory->table()->action()->multi(
340 $this->
lng->txt(
'disable_hide_user_toggle'),
341 $url_builder->
withParameter($action_parameter_token,
'disableHideUserToggleNoti'),
344 'notificationSettings' => $this->ui_factory->table()->action()->single(
345 $this->
lng->txt(
'notification_settings'),
346 $url_builder->
withParameter($action_parameter_token,
'notificationSettings'),
395 [$order_field, $order_direction] = $order->
join(
397 fn($ret, $key, $value) => [$key, $value]
399 usort($records,
static fn(array $left, array $right):
int =>
ilStr::strCmp(
400 $left[$order_field] ??
'',
401 $right[$order_field] ??
'' 405 $records = array_reverse($records);
417 'login' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'login')),
418 'firstname' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'firstname')),
419 'lastname' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'lastname')),
420 'user_toggle_noti' => $this->ui_factory->table()->column()->statusIcon(
421 $this->
lng->txt(
'allow_user_toggle_noti')
423 ->withIsSortable(
false),
424 'role' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'role')),
orderRecords(array $records, Order $order)
getUserNotificationTableData(array $user_ids)
limitRecords(array $records, Range $range)
join($init, callable $fn)
FilterComponent $filter_component
Interface Observer Contains several chained tasks and infos about them.
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
static _lookupName(int $a_user_id)
lookup user name
__construct(private readonly ServerRequestInterface $http_request, private readonly ilLanguage $lng, private readonly UIFactory $ui_factory, private readonly DataFactory $data_factory, private readonly int $ref_id, private readonly ilParticipants $participants, private readonly ilForumNotification $forumNotificationObj, private readonly ilUIService $ui_service, private readonly string $action)
Both the subject and the direction need to be specified when expressing an order. ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
initRecords(?array $filter_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static strCmp(string $a, string $b)
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
DataTable $table_component
static _getModerators(int $a_ref_id)
getRecords(Range $range, Order $order, ?array $filter_data)
getFilteredUserIds(?array $filter_data)
A simple class to express a naive range of whole positive numbers.
getRows(\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters,)
getFilterFields(Factory $field_factory)
static _lookupLogin(int $a_user_id)