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

Public Member Functions

 __construct (protected int $calendar_id, protected ilLanguage $lng, protected UIFactory $ui_factory)
 
 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

 getShared ()
 

Protected Attributes

ilCalendarShared $shared
 

Detailed Description

Definition at line 34 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Calendar\Shared\Outgoing\DataRetrieval::__construct ( protected int  $calendar_id,
protected ilLanguage  $lng,
protected UIFactory  $ui_factory 
)

Definition at line 38 of file DataRetrieval.php.

42 {
43 }

Member Function Documentation

◆ getAllIDs()

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

Implements ILIAS\Calendar\Shared\DataRetrievalInterface.

Definition at line 112 of file DataRetrieval.php.

112 : array
113 {
114 $ids = [];
115 foreach ($this->getShared()->getShared() as $item) {
116 $ids[] = (int) $item['obj_id'];
117 }
118 return $ids;
119 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\Calendar\Shared\Outgoing\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 50 of file DataRetrieval.php.

58 : Generator {
59 $data = [];
60 foreach ($this->getShared()->getShared() as $item) {
61 $datum = [];
62 $obj_id = (int) $item['obj_id'];
63 switch ($item['obj_type']) {
65 $datum[TableBuilder::TYPE_COLUMN] = 'usr';
66 $name = ilObjUser::_lookupName($obj_id);
67 $datum[TableBuilder::TITLE_COLUMN] = $name['lastname'] . ', ' . $name['firstname'];
69 break;
70
72 $datum[TableBuilder::TYPE_COLUMN] = 'role';
75 break;
76 }
77 $datum[TableBuilder::WRITABLE_COLUMN] = (bool) $item['writable'];
78
79 $data[$obj_id] = $datum;
80 }
81
82 $order_field = array_keys($order->get())[0];
83 $order_direction = $order->get()[$order_field];
84 uasort($data, fn($a, $b) => strtolower((string) $a[$order_field]) <=> strtolower((string) $b[$order_field]));
85 if ($order_direction === Order::DESC) {
86 $data = array_reverse($data, true);
87 }
88 $data = array_slice($data, $range->getStart(), $range->getLength(), true);
89
90 $usr_icon = $this->ui_factory->symbol()->icon()->standard('usr', $this->lng->txt('obj_usr'));
91 $role_icon = $this->ui_factory->symbol()->icon()->standard('role', $this->lng->txt('obj_role'));
92
93 foreach ($data as $id => $datum) {
95 'usr' => $usr_icon,
96 'role' => $role_icon
97 };
99 true => $this->lng->txt('cal_shared_access_read_write'),
100 false => $this->lng->txt('cal_shared_access_read_only')
101 };
102 yield $row_builder->buildDataRow(
103 (string) $id,
104 $datum
105 );
106 }
107 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
const DESC
Definition: Order.php:31
static _lookupName(int $a_user_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$data
Definition: storeScorm.php:45

References $data, ilObject\_lookupDescription(), ilObjUser\_lookupName(), ilObject\_lookupTitle(), ILIAS\Calendar\Shared\Outgoing\TableBuilder\DESCRIPTION_COLUMN, ILIAS\Repository\int(), ILIAS\Calendar\Shared\Outgoing\TableBuilder\TITLE_COLUMN, ILIAS\Calendar\Shared\Outgoing\TableBuilder\TYPE_COLUMN, ilCalendarShared\TYPE_ROLE, ilCalendarShared\TYPE_USR, and ILIAS\Calendar\Shared\Outgoing\TableBuilder\WRITABLE_COLUMN.

+ Here is the call graph for this function:

◆ getShared()

ILIAS\Calendar\Shared\Outgoing\DataRetrieval::getShared ( )
protected

Definition at line 45 of file DataRetrieval.php.

46 {
47 return $this->shared ??= new ilCalendarShared($this->calendar_id);
48 }
Handles shared calendars.

◆ getTotalRowCount()

ILIAS\Calendar\Shared\Outgoing\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 121 of file DataRetrieval.php.

125 : ?int {
126 return count($this->getShared()->getShared());
127 }

Field Documentation

◆ $shared

ilCalendarShared ILIAS\Calendar\Shared\Outgoing\DataRetrieval::$shared
protected

Definition at line 36 of file DataRetrieval.php.


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