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

Public Member Functions

 __construct (private readonly int $ref_id, private readonly ilMailMemberSearchDataProvider $provider, private readonly ilCtrl $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 32 of file MailMemberSearchTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::__construct ( private readonly int  $ref_id,
private readonly ilMailMemberSearchDataProvider  $provider,
private readonly ilCtrl  $ctrl,
private readonly ilLanguage  $lng,
private readonly \ILIAS\UI\Factory  $ui_factory,
\ILIAS\HTTP\GlobalHttpState  $http 
)

Definition at line 39 of file MailMemberSearchTable.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\MemberSearch\MailMemberSearchTable::getActions ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 97 of file MailMemberSearchTable.php.

97 : array
98 {
99 $query_params_namespace = ['contact', 'search', 'members'];
100
101 $uri = $this->data_factory->uri(
102 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
103 \ilMailMemberSearchGUI::class,
104 'handleSearchMembersActions'
105 )
106 );
107
108 $url_builder = new UI\URLBuilder($uri);
109 [
110 $url_builder,
111 $action_parameter_token_copy,
112 $row_id_token
113 ] = $url_builder->acquireParameters(
114 $query_params_namespace,
115 'action',
116 'user_ids'
117 );
118
119 return [
120 'sendMailToSelectedUsers' => $this->ui_factory->table()->action()->multi(
121 $this->lng->txt('mail_members'),
122 $url_builder->withParameter($action_parameter_token_copy, 'sendMailToSelectedUsers'),
123 $row_id_token
124 ),
125 ];
126 }

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

Referenced by ILIAS\Contact\MemberSearch\MailMemberSearchTable\getComponent().

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

◆ getColumns()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::getColumns ( )
private
Returns
array<string, Column>

Definition at line 73 of file MailMemberSearchTable.php.

73 : array
74 {
75 return [
76 'login' => $this->ui_factory
77 ->table()
78 ->column()
79 ->text($this->lng->txt('login'))
80 ->withIsSortable(true),
81 'name' => $this->ui_factory
82 ->table()
83 ->column()
84 ->text($this->lng->txt('name'))
85 ->withIsSortable(true),
86 'role' => $this->ui_factory
87 ->table()
88 ->column()
89 ->text($this->lng->txt('role'))
90 ->withIsSortable(true),
91 ];
92 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Contact\MemberSearch\MailMemberSearchTable\getComponent().

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

◆ getComponent()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::getComponent ( )

Definition at line 51 of file MailMemberSearchTable.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 $this->lng->txt('members'),
61 $columns,
62 )
63 ->withId(str_replace('\\', '', self::class) . '_' . $this->ref_id)
64 ->withOrder(new \ILIAS\Data\Order('login', \ILIAS\Data\Order::ASC))
65 ->withRange(new \ILIAS\Data\Range(0, 50))
66 ->withActions($actions)
67 ->withRequest($this->request);
68 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

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

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::getRecords ( Data\Range  $range,
Data\Order  $order 
)
private

◆ getRows()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::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 146 of file MailMemberSearchTable.php.

154 : \Generator {
155 $records = $this->getRecords($range, $order);
156
157 foreach ($records as $record) {
158 $row_id = (string) $record['user_id'];
159 yield $row_builder->buildDataRow($row_id, $record);
160 }
161 }
getRecords(Data\Range $range, Data\Order $order)

◆ getTotalRowCount()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::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 163 of file MailMemberSearchTable.php.

167 : ?int {
168 $this->initRecords();
169
170 return \count($this->records);
171 }

◆ initRecords()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::initRecords ( )
private

Definition at line 128 of file MailMemberSearchTable.php.

128 : void
129 {
130 if ($this->records === null) {
131 $this->records = [];
132 $i = 0;
133 $entries = $this->provider->getData();
134 if ($entries !== []) {
135 foreach ($entries as $entry) {
136 $this->records[$i]['user_id'] = (int) $entry['user_id'];
137 $this->records[$i]['login'] = $entry['login'];
138 $this->records[$i]['name'] = $entry['name'];
139 $this->records[$i]['role'] = $entry['role'];
140 ++$i;
141 }
142 }
143 }
144 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ limitRecords()

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

Definition at line 200 of file MailMemberSearchTable.php.

200 : array
201 {
202 return \array_slice($records, $range->getStart(), $range->getLength());
203 }

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\MemberSearch\MailMemberSearchTable::sortedRecords ( Data\Order  $order)
private
Returns
list<array<string, mixed>>array

Definition at line 176 of file MailMemberSearchTable.php.

176 : array
177 {
179 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
180
181 return ilArrayUtil::stableSortArray($records, $order_field, strtolower($order_direction), false);
182 }
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\MemberSearch\MailMemberSearchTable::$data_factory
private

Definition at line 35 of file MailMemberSearchTable.php.

◆ $records

array ILIAS\Contact\MemberSearch\MailMemberSearchTable::$records = null
private

Definition at line 37 of file MailMemberSearchTable.php.

◆ $request

readonly ServerRequestInterface ILIAS\Contact\MemberSearch\MailMemberSearchTable::$request
private

Definition at line 34 of file MailMemberSearchTable.php.


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