ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Calendar\Shared\Inbox\DataRetrieval Class Reference
+ Inheritance diagram for ILIAS\Calendar\Shared\Inbox\DataRetrieval:
+ Collaboration diagram for ILIAS\Calendar\Shared\Inbox\DataRetrieval:

Public Member Functions

 __construct (protected int $user_id)
 
 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...
 
 getAllIDs ()
 
 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...
 
 getAllIDs ()
 
 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...
 

Protected Member Functions

 getOpenInvitations ()
 

Protected Attributes

array $open_invitations
 

Detailed Description

Definition at line 32 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Calendar\Shared\Inbox\DataRetrieval::__construct ( protected int  $user_id)

Definition at line 36 of file DataRetrieval.php.

38 {
39 }

Member Function Documentation

◆ getAllIDs()

ILIAS\Calendar\Shared\Inbox\DataRetrieval::getAllIDs ( )
Returns
int[]

Implements ILIAS\Calendar\Shared\DataRetrievalInterface.

Definition at line 90 of file DataRetrieval.php.

90 : array
91 {
92 $ids = [];
93 foreach ($this->getOpenInvitations() as $item) {
94 $ids[] = (int) $item['cal_id'];
95 }
96 return $ids;
97 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getOpenInvitations()

ILIAS\Calendar\Shared\Inbox\DataRetrieval::getOpenInvitations ( )
protected

Definition at line 41 of file DataRetrieval.php.

41 : array
42 {
43 return $this->open_invitations ??= new ilCalendarSharedStatus($this->user_id)->getOpenInvitations();
44 }
Stores status (accepted/declined) of shared calendars.

References ilCalendarSharedStatus\getOpenInvitations().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\Calendar\Shared\Inbox\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.

yield $row_builder->buildStandardRow($row_id, $record).

Parameters
string[]$visible_column_ids

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 46 of file DataRetrieval.php.

54 : Generator {
55 $data = [];
56 foreach ($this->getOpenInvitations() as $item) {
57 $datum = [];
58 $datum[TableBuilder::NAME_COLUMN] = $item['name'];
59 $name = ilObjUser::_lookupName((int) $item['owner']);
60 $datum[TableBuilder::OWNER_COLUMN] = $name['lastname'] . ', ' . $name['firstname'];
61 $datum[TableBuilder::APPOINTMENTS_COUNT_COLUMN] = (int) $item['apps'];
62 $datum[TableBuilder::CREATED_ON_COLUMN] = new DateTimeImmutable($item['create_date']);
63
64 $data[(int) $item['cal_id']] = $datum;
65 }
66
67 $order_field = array_keys($order->get())[0];
68 $order_direction = $order->get()[$order_field];
69 if ($order_field === TableBuilder::CREATED_ON_COLUMN || $order_field === TableBuilder::APPOINTMENTS_COUNT_COLUMN) {
70 uasort($data, fn($a, $b) => $a[$order_field] <=> $b[$order_field]);
71 } else {
72 uasort($data, fn($a, $b) => strtolower((string) $a[$order_field]) <=> strtolower((string) $b[$order_field]));
73 }
74 if ($order_direction === Order::DESC) {
75 $data = array_reverse($data, true);
76 }
77 $data = array_slice($data, $range->getStart(), $range->getLength(), true);
78
79 foreach ($data as $id => $datum) {
80 yield $row_builder->buildDataRow(
81 (string) $id,
82 $datum
83 );
84 }
85 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
const DESC
Definition: Order.php:31
static _lookupName(int $a_user_id)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$data
Definition: storeScorm.php:45

References $data, ilObjUser\_lookupName(), ILIAS\Calendar\Shared\Inbox\TableBuilder\APPOINTMENTS_COUNT_COLUMN, ILIAS\Calendar\Shared\Inbox\TableBuilder\CREATED_ON_COLUMN, ILIAS\Repository\int(), ILIAS\Calendar\Shared\Inbox\TableBuilder\NAME_COLUMN, and ILIAS\Calendar\Shared\Inbox\TableBuilder\OWNER_COLUMN.

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\Calendar\Shared\Inbox\DataRetrieval::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 99 of file DataRetrieval.php.

103 : ?int {
104 return count($this->getOpenInvitations());
105 }

Field Documentation

◆ $open_invitations

array ILIAS\Calendar\Shared\Inbox\DataRetrieval::$open_invitations
protected

Definition at line 34 of file DataRetrieval.php.


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