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

Public Member Functions

 __construct (protected ilCalendarCategories $categories, protected ilCalendarActions $actions, 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...
 
 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...
 
 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

 buildTypeIcon (int $type, string $obj_type)
 
 disableInactiveActions (int $id, DataRow $row)
 

Detailed Description

Definition at line 37 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Calendar\Manage\DataRetrieval::__construct ( protected ilCalendarCategories  $categories,
protected ilCalendarActions  $actions,
protected ilLanguage  $lng,
protected UIFactory  $ui_factory 
)

Definition at line 39 of file DataRetrieval.php.

44 {
45 }

Member Function Documentation

◆ buildTypeIcon()

ILIAS\Calendar\Manage\DataRetrieval::buildTypeIcon ( int  $type,
string  $obj_type 
)
protected

Definition at line 106 of file DataRetrieval.php.

106 : ?Icon
107 {
108 $f = $this->ui_factory->symbol()->icon();
109 $size = Icon::MEDIUM;
110 return match ($type) {
112 'assets/images/standard/icon_calg.svg',
113 $this->lng->txt('cal_type_system'),
114 $size
115 ),
117 'assets/images/standard/icon_calch.svg',
118 $this->lng->txt('cal_ch_ch'),
119 $size
120 ),
121 ilCalendarCategory::TYPE_USR => $f->standard(
122 'usr',
123 $this->lng->txt('cal_type_personal'),
124 $size
125 ),
126 ilCalendarCategory::TYPE_OBJ => $f->standard(
127 $obj_type,
128 $this->lng->txt('cal_type_' . $type),
129 $size
130 ),
132 'book',
133 $this->lng->txt('cal_type_' . $type),
134 $size
135 ),
136 default => null
137 };
138 }

References Vendor\Package\$f, ILIAS\Repository\lng(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

+ Here is the call graph for this function:

◆ disableInactiveActions()

ILIAS\Calendar\Manage\DataRetrieval::disableInactiveActions ( int  $id,
DataRow  $row 
)
protected

Definition at line 140 of file DataRetrieval.php.

140 : DataRow
141 {
142 if (!$this->actions->checkSettingsCal($id)) {
143 $row = $row->withDisabledAction(TableBuilder::ACTION_EDIT);
144 }
145 if (!$this->actions->checkAddEvent($id)) {
146 $row = $row->withDisabledAction(TableBuilder::ACTION_IMPORT);
147 }
148 if (!$this->actions->checkShareCal($id)) {
149 $row = $row->withDisabledAction(TableBuilder::ACTION_SHARE);
150 }
151 if (!$this->actions->checkSynchronizeCal($id)) {
152 $row = $row->withDisabledAction(TableBuilder::ACTION_SYNCHRONIZE);
153 }
154 if (!$this->actions->checkDeleteCal($id)) {
155 $row = $row->withDisabledAction(TableBuilder::ACTION_DELETE);
156 }
157 return $row;
158 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\UI\Component\Table\DataRow\withDisabledAction().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\Calendar\Manage\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 47 of file DataRetrieval.php.

55 : Generator {
56 $data = [];
57 foreach ($this->categories->getCategoriesInfo() as $info) {
58 $datum = [];
59 $datum['title'] = $info['title'];
60 $datum['type'] = $info['type'];
61 $datum['obj_id'] = $info['obj_id'];
62 $datum['obj_type'] =
64 ilObject::_lookupType($info['obj_id']) : '';
65 $datum['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($info['type']) .
66 ($info['type'] === ilCalendarCategory::TYPE_OBJ ? $datum['obj_type'] : ''); // Append object type to make type sortable
67 $data[$info['cat_id']] = $datum;
68 }
69
70 $order_field = array_keys($order->get())[0];
71 $order_direction = $order->get()[$order_field];
72 $order_field = match($order_field) {
73 TableBuilder::TYPE_COLUMN => 'type_sortable',
74 default => 'title'
75 };
76 uasort($data, fn($a, $b) => strtolower((string) $a[$order_field]) <=> strtolower((string) $b[$order_field]));
77 if ($order_direction === Order::DESC) {
78 $data = array_reverse($data, true);
79 }
80 $data = array_slice($data, $range->getStart(), $range->getLength(), true);
81
82 $usr_icon = $this->ui_factory->symbol()->icon()->standard('usr', $this->lng->txt('obj_usr'));
83 $role_icon = $this->ui_factory->symbol()->icon()->standard('role', $this->lng->txt('obj_role'));
84
85 foreach ($data as $id => $datum) {
86 $row_datum = [TableBuilder::TITLE_COLUMN => $datum['title']];
87 if ($icon = $this->buildTypeIcon($datum['type'], $datum['obj_type'])) {
88 $row_datum[TableBuilder::TYPE_COLUMN] = $icon;
89 }
90 $row = $row_builder->buildDataRow(
91 (string) $id,
92 $row_datum
93 );
94 yield $this->disableInactiveActions($id, $row);
95 }
96 }
buildTypeIcon(int $type, string $obj_type)
disableInactiveActions(int $id, DataRow $row)
const DESC
Definition: Order.php:31
static lookupCategorySortIndex(int $a_type_id)
Lookup sort index of calendar type.
static _lookupType(int $id, bool $reference=false)
$info
Definition: entry_point.php:21
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
$data
Definition: storeScorm.php:45

References $data, $info, ilObject\_lookupType(), ilCalendarCategory\lookupCategorySortIndex(), ilCalendarCategory\TYPE_BOOK, and ilCalendarCategory\TYPE_OBJ.

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\Calendar\Manage\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 98 of file DataRetrieval.php.

102 : ?int {
103 return count($this->categories->getCategoriesInfo());
104 }

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