ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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, ?array $filter_data, ?array $additional_parameters)
 
 getTotalRowCount (?array $filter_data, ?array $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, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. 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

Member Function Documentation

◆ getActions()

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

Definition at line 96 of file MailMemberSearchTable.php.

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

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

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

References ILIAS\Repository\lng().

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

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

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

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(self::class . '_' . $this->ref_id)
64  ->withOrder(new \ILIAS\Data\Order('login', \ILIAS\Data\Order::ASC))
65  ->withActions($actions)
66  ->withRequest($this->request);
67  }
Interface Observer Contains several chained tasks and infos about them.
+ 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,
?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 145 of file MailMemberSearchTable.php.

References ILIAS\Contact\MemberSearch\MailMemberSearchTable\getRecords().

152  : \Generator {
153  $records = $this->getRecords($range, $order);
154 
155  foreach ($records as $record) {
156  $row_id = (string) $record['user_id'];
157  yield $row_builder->buildDataRow($row_id, $record);
158  }
159  }
getRecords(Data\Range $range, Data\Order $order)
+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\Contact\MemberSearch\MailMemberSearchTable::getTotalRowCount ( ?array  $filter_data,
?array  $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 161 of file MailMemberSearchTable.php.

References ILIAS\Contact\MemberSearch\MailMemberSearchTable\initRecords().

164  : ?int {
165  $this->initRecords();
166 
167  return \count($this->records);
168  }
+ Here is the call graph for this function:

◆ initRecords()

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

Definition at line 127 of file MailMemberSearchTable.php.

References ILIAS\Repository\int(), and null.

Referenced by ILIAS\Contact\MemberSearch\MailMemberSearchTable\getRecords(), and ILIAS\Contact\MemberSearch\MailMemberSearchTable\getTotalRowCount().

127  : void
128  {
129  if ($this->records === null) {
130  $this->records = [];
131  $i = 0;
132  $entries = $this->provider->getData();
133  if ($entries !== []) {
134  foreach ($entries as $entry) {
135  $this->records[$i]['user_id'] = (int) $entry['user_id'];
136  $this->records[$i]['login'] = $entry['login'];
137  $this->records[$i]['name'] = $entry['name'];
138  $this->records[$i]['role'] = $entry['role'];
139  ++$i;
140  }
141  }
142  }
143  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller 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 197 of file MailMemberSearchTable.php.

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

+ Here is the caller graph for this function:

◆ sortedRecords()

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

Definition at line 173 of file MailMemberSearchTable.php.

References ILIAS\Contact\MemberSearch\MailMemberSearchTable\$records, and ilArrayUtil\stableSortArray().

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

173  : array
174  {
176  [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
177 
178  return ilArrayUtil::stableSortArray($records, $order_field, strtolower($order_direction), false);
179  }
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...
+ Here is the call graph for this function:
+ Here is the caller 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

◆ $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: