ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\Contact\MailingLists\MailingListsMembersTable Class Reference
+ Inheritance diagram for ILIAS\Contact\MailingLists\MailingListsMembersTable:
+ Collaboration diagram for ILIAS\Contact\MailingLists\MailingListsMembersTable:

Public Member Functions

 __construct (private readonly ilMailingList $mailing_list, private readonly \ilCtrlInterface $ctrl, private readonly ilLanguage $lng, private readonly \ILIAS\UI\Factory $ui_factory, \ILIAS\HTTP\GlobalHttpState $http)
 
 getComponent ()
 
 getRows (UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Data\Range $range, Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 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 records available. More...
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 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 records available. More...
 

Private Member Functions

 getColumns ()
 
 getActions ()
 
 initRecords ()
 
 sortedRecords (Data\Order $order)
 
 getRecords (Data\Range $range, Data\Order $order)
 
 limitRecords (array $records, Data\Range $range)
 

Private Attributes

readonly ServerRequestInterface $request
 
readonly Data Factory $data_factory
 
array $records = null
 

Detailed Description

Definition at line 33 of file MailingListsMembersTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Contact\MailingLists\MailingListsMembersTable::__construct ( private readonly ilMailingList  $mailing_list,
private readonly \ilCtrlInterface  $ctrl,
private readonly ilLanguage  $lng,
private readonly \ILIAS\UI\Factory  $ui_factory,
\ILIAS\HTTP\GlobalHttpState  $http 
)

Definition at line 40 of file MailingListsMembersTable.php.

46 {
47 $this->request = $http->request();
48 $this->data_factory = new Data\Factory();
49 }
$http
Definition: deliver.php:30

References $http.

Member Function Documentation

◆ getActions()

ILIAS\Contact\MailingLists\MailingListsMembersTable::getActions ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 90 of file MailingListsMembersTable.php.

90 : array
91 {
92 $query_params_namespace = ['contact', 'mailinglist', 'members'];
93
94 $uri = $this->data_factory->uri(
95 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
96 ilMailingListsGUI::class,
97 'handleMailingListMemberActions'
98 )
99 );
100
101 $url_builder = new UI\URLBuilder($uri);
102 [
103 $url_builder,
104 $action_parameter_token_copy,
105 $row_id_token
106 ] = $url_builder->acquireParameters(
107 $query_params_namespace,
108 'action',
109 'entry_ids'
110 );
111
112 return [
113 'confirmDeleteMembers' => $this->ui_factory->table()->action()->multi(
114 $this->lng->txt('remove'),
115 $url_builder->withParameter($action_parameter_token_copy, 'confirmDeleteMembers'),
116 $row_id_token
117 ),
118 ];
119 }

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

Referenced by ILIAS\Contact\MailingLists\MailingListsMembersTable\getComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\Contact\MailingLists\MailingListsMembersTable::getColumns ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Column\Column>

Definition at line 76 of file MailingListsMembersTable.php.

76 : array
77 {
78 return [
79 'login' => $this->ui_factory
80 ->table()
81 ->column()
82 ->text($this->lng->txt('login'))
83 ->withIsSortable(true),
84 ];
85 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Contact\MailingLists\MailingListsMembersTable\getComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ILIAS\Contact\MailingLists\MailingListsMembersTable::getComponent ( )

Definition at line 51 of file MailingListsMembersTable.php.

51 : UI\Component\Table\Data
52 {
53 $columns = $this->getColumns();
54 $actions = $this->getActions();
55
56 return $this->ui_factory
57 ->table()
58 ->data(
59 $this,
60 \sprintf(
61 $this->lng->txt('mail_members_of_mailing_list'),
62 $this->mailing_list->getTitle()
63 ),
64 $columns,
65 )
66 ->withId(str_replace('\\', '', self::class) . '_' . $this->mailing_list->getId())
67 ->withOrder(new \ILIAS\Data\Order('login', \ILIAS\Data\Order::ASC))
68 ->withRange(new Range(0, 50))
69 ->withActions($actions)
70 ->withRequest($this->request);
71 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Data\Order\ASC, ILIAS\Contact\MailingLists\MailingListsMembersTable\getActions(), ILIAS\Contact\MailingLists\MailingListsMembersTable\getColumns(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\Contact\MailingLists\MailingListsMembersTable::getRecords ( Data\Range  $range,
Data\Order  $order 
)
private

◆ getRows()

ILIAS\Contact\MailingLists\MailingListsMembersTable::getRows ( UI\Component\Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
Data\Range  $range,
Data\Order  $order,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Definition at line 141 of file MailingListsMembersTable.php.

149 : \Generator {
150 $records = $this->getRecords($range, $order);
151
152 foreach ($records as $record) {
153 $row_id = (string) $record['a_id'];
154 yield $row_builder->buildDataRow($row_id, $record);
155 }
156 }

◆ getTotalRowCount()

ILIAS\Contact\MailingLists\MailingListsMembersTable::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 records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 158 of file MailingListsMembersTable.php.

162 : ?int {
163 $this->initRecords();
164
165 return \count($this->records);
166 }

◆ initRecords()

ILIAS\Contact\MailingLists\MailingListsMembersTable::initRecords ( )
private

Definition at line 121 of file MailingListsMembersTable.php.

121 : void
122 {
123 if ($this->records === null) {
124 $this->records = [];
125 $i = 0;
126 $entries = $this->mailing_list->getAssignedEntries();
127 if ($entries !== []) {
128 $usr_ids = array_map(static fn(array $entry): int => (int) $entry['usr_id'], $entries);
129 $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
130
131 foreach ($entries as $entry) {
132 $this->records[$i]['a_id'] = $entry['a_id'];
133 $this->records[$i]['user_id'] = $entry['usr_id'];
134 $this->records[$i]['login'] = $names[$entry['usr_id']];
135 ++$i;
136 }
137 }
138 }
139 }
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=null)
Default behaviour is:

References ilUserUtil\getNamePresentation().

+ Here is the call graph for this function:

◆ limitRecords()

ILIAS\Contact\MailingLists\MailingListsMembersTable::limitRecords ( array  $records,
Data\Range  $range 
)
private
Parameters
list<array<string,mixed>>$records
Returns
list<array<string, mixed>>

Definition at line 195 of file MailingListsMembersTable.php.

195 : array
196 {
197 return \array_slice($records, $range->getStart(), $range->getLength());
198 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

+ Here is the call graph for this function:

◆ sortedRecords()

ILIAS\Contact\MailingLists\MailingListsMembersTable::sortedRecords ( Data\Order  $order)
private
Returns
list<array<string, mixed>>array

Definition at line 171 of file MailingListsMembersTable.php.

171 : array
172 {
174 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
175
176 return ilArrayUtil::stableSortArray($records, $order_field, strtolower($order_direction), false);
177 }
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...

References ilArrayUtil\stableSortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

readonly Data Factory ILIAS\Contact\MailingLists\MailingListsMembersTable::$data_factory
private

Definition at line 36 of file MailingListsMembersTable.php.

◆ $records

array ILIAS\Contact\MailingLists\MailingListsMembersTable::$records = null
private

Definition at line 38 of file MailingListsMembersTable.php.

◆ $request

readonly ServerRequestInterface ILIAS\Contact\MailingLists\MailingListsMembersTable::$request
private

Definition at line 35 of file MailingListsMembersTable.php.


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