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

Public Member Functions

 __construct (protected readonly UIServices $ui, protected readonly ilCtrl $ctrl)
 
 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

 getSCGroups ()
 

Protected Attributes

array $groups
 

Detailed Description

Definition at line 38 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\SystemCheck\Table\Group\DataRetrieval::__construct ( protected readonly UIServices  $ui,
protected readonly ilCtrl  $ctrl 
)

Definition at line 43 of file DataRetrieval.php.

46 {
47 }

Member Function Documentation

◆ getRows()

ILIAS\SystemCheck\Table\Group\DataRetrieval::getRows ( DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)
final

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 57 of file DataRetrieval.php.

65 : Generator {
66 [$column_name, $direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
67 $titles = $descriptions = $last_updates = $complete = $failed = [];
68 foreach ($this->getSCGroups() as $group) {
70 $titles[$group->getId()] = $task_gui->getGroupTitle();
71 $descriptions[$group->getId()] = $task_gui->getGroupDescription();
72 $complete[$group->getId()] = ilSCTasks::lookupCompleted($group->getId());
73 $failed[$group->getId()] = ilSCTasks::lookupFailed($group->getId());
74 $last_updates[$group->getId()] = ilSCTasks::lookupLastUpdate($group->getId());
75 }
76 $comparator = match ($column_name) {
77 Handler::TABLE_COL_TITLE => function (ilSCGroup $f1, ilSCGroup $f2) use ($titles) {
78 return strcasecmp($titles[$f1->getId()], $titles[$f2->getId()]);
79 },
80 Handler::TABLE_COL_DESCRIPTION => function (ilSCGroup $f1, ilSCGroup $f2) use ($descriptions) {
81 return strcasecmp($descriptions[$f1->getId()], $descriptions[$f2->getId()]);
82 },
83 Handler::TABLE_COL_LAST_UPDATE => function (ilSCGroup $f1, ilSCGroup $f2) use ($last_updates) {
84 if (ilDateTime::_equals($last_updates[$f1->getId()], $last_updates[$f2->getId()])) {
85 return 0;
86 }
87 return ilDateTime::_before($last_updates[$f1->getId()], $last_updates[$f2->getId()]) ? -1 : 1;
88 },
89 Handler::TABLE_COL_SOLVED_TASKS => function (ilSCGroup $f1, ilSCGroup $f2) use ($complete) {
90 return $complete[$f1->getId()] - $complete[$f2->getId()];
91 },
92 Handler::TABLE_COL_UNSOLVED_TASKS => function (ilSCGroup $f1, ilSCGroup $f2) use ($failed) {
93 return $failed[$f1->getId()] - $failed[$f2->getId()];
94 },
95 default => fn(ilSCGroup $f1, ilSCGroup $f2) => 0
96 };
97 $sc_groups = $this->getSCGroups();
98 uasort($sc_groups, $comparator);
99 if ($direction === "DESC") {
100 $sc_groups = array_reverse($sc_groups, true);
101 }
102 $sc_groups = array_slice($sc_groups, $range->getStart(), $range->getLength(), true);
103 foreach ($sc_groups as $sc_group) {
104 $this->ctrl->setParameterByClass(ilObjSystemCheckGUI::class, 'grp_id', $sc_group->getId());
105 $link = $this->ctrl->getLinkTargetByClass(ilObjSystemCheckGUI::class, 'showGroup');
106 $this->ctrl->clearParameterByClass(ilObjSystemCheckGUI::class, 'grp_id');
107 yield $row_builder->buildDataRow(
108 $sc_group->getId() . '',
109 [
110 Handler::TABLE_COL_TITLE => $this->ui->factory()->link()->standard($titles[$sc_group->getId()], $link),
111 Handler::TABLE_COL_DESCRIPTION => $descriptions[$sc_group->getId()],
112 Handler::TABLE_COL_LAST_UPDATE => ilDatePresentation::formatDate($last_updates[$sc_group->getId()]),
113 Handler::TABLE_COL_SOLVED_TASKS => $complete[$sc_group->getId()],
114 Handler::TABLE_COL_UNSOLVED_TASKS => $failed[$sc_group->getId()],
115 ]
116 );
117 }
118 }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static getComponentTaskGUIForGroup(int $a_group_id, ?int $a_task_id=null)
Defines a system check group including different tasks of a component.
static lookupLastUpdate(int $a_grp_id)
static lookupFailed(int $a_grp_id)
static lookupCompleted(int $a_grp_id)

References ilSCComponentTaskFactory\getComponentTaskGUIForGroup(), ilSCTasks\lookupCompleted(), ilSCTasks\lookupFailed(), and ilSCTasks\lookupLastUpdate().

+ Here is the call graph for this function:

◆ getSCGroups()

ILIAS\SystemCheck\Table\Group\DataRetrieval::getSCGroups ( )
finalprotected
Returns
ilSCGroup[]

Definition at line 52 of file DataRetrieval.php.

52 : array
53 {
54 return $this->groups ??= ilSCGroups::getInstance()->getGroups();
55 }
static getInstance()

References ilSCGroups\getInstance().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\SystemCheck\Table\Group\DataRetrieval::getTotalRowCount ( mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)
final

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 120 of file DataRetrieval.php.

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

Field Documentation

◆ $groups

array ILIAS\SystemCheck\Table\Group\DataRetrieval::$groups
protected

Definition at line 41 of file DataRetrieval.php.


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