ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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, ?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 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 39 of file MailingListsMembersTable.php.

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

Member Function Documentation

◆ getActions()

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

Definition at line 88 of file MailingListsMembersTable.php.

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

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

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

Definition at line 74 of file MailingListsMembersTable.php.

References ILIAS\Repository\lng().

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

74  : array
75  {
76  return [
77  'login' => $this->ui_factory
78  ->table()
79  ->column()
80  ->text($this->lng->txt('login'))
81  ->withIsSortable(true),
82  ];
83  }
+ 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 50 of file MailingListsMembersTable.php.

References ILIAS\Data\Order\ASC, ILIAS\Contact\MailingLists\MailingListsMembersTable\getActions(), ILIAS\Contact\MailingLists\MailingListsMembersTable\getColumns(), ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Table\withOrder().

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

Definition at line 139 of file MailingListsMembersTable.php.

References ILIAS\Contact\MailingLists\MailingListsMembersTable\getRecords().

146  : \Generator {
147  $records = $this->getRecords($range, $order);
148 
149  foreach ($records as $record) {
150  $row_id = (string) $record['a_id'];
151  yield $row_builder->buildDataRow($row_id, $record);
152  }
153  }
+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\Contact\MailingLists\MailingListsMembersTable::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 155 of file MailingListsMembersTable.php.

References ILIAS\Contact\MailingLists\MailingListsMembersTable\initRecords().

158  : ?int {
159  $this->initRecords();
160 
161  return \count($this->records);
162  }
+ Here is the call graph for this function:

◆ initRecords()

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

Definition at line 119 of file MailingListsMembersTable.php.

References ilUserUtil\getNamePresentation(), and null.

Referenced by ILIAS\Contact\MailingLists\MailingListsMembersTable\getRecords(), and ILIAS\Contact\MailingLists\MailingListsMembersTable\getTotalRowCount().

119  : void
120  {
121  if ($this->records === null) {
122  $this->records = [];
123  $i = 0;
124  $entries = $this->mailing_list->getAssignedEntries();
125  if ($entries !== []) {
126  $usr_ids = array_map(static fn(array $entry): int => (int) $entry['usr_id'], $entries);
127  $names = ilUserUtil::getNamePresentation($usr_ids, false, false, '', false, false, false);
128 
129  foreach ($entries as $entry) {
130  $this->records[$i]['a_id'] = $entry['a_id'];
131  $this->records[$i]['user_id'] = $entry['usr_id'];
132  $this->records[$i]['login'] = $names[$entry['usr_id']];
133  ++$i;
134  }
135  }
136  }
137  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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='ilpublicuserprofilegui')
Default behaviour is:
+ Here is the call graph for this function:
+ Here is the caller 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 191 of file MailingListsMembersTable.php.

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

+ Here is the caller graph for this function:

◆ sortedRecords()

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

Definition at line 167 of file MailingListsMembersTable.php.

References ILIAS\Contact\MailingLists\MailingListsMembersTable\$records, and ilArrayUtil\stableSortArray().

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

167  : array
168  {
170  [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
171 
172  return ilArrayUtil::stableSortArray($records, $order_field, strtolower($order_direction), false);
173  }
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\MailingLists\MailingListsMembersTable::$data_factory
private

Definition at line 35 of file MailingListsMembersTable.php.

◆ $records

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

◆ $request

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

Definition at line 34 of file MailingListsMembersTable.php.


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