3 declare(strict_types=1);
33 $r = $DIC[
'ui.renderer'];
36 $table = $repo->getTableForRepresentation();
39 $table->withRequest($DIC->http()->request())
46 protected \ILIAS\Data\Factory
$df;
51 $this->ui_factory = $DIC[
'ui.factory'];
52 $this->df = new \ILIAS\Data\Factory();
58 return $this->ui_factory->table()->data(
59 'a data table from a repository',
68 array $visible_column_ids,
72 ?array $additional_parameters
75 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_checked.svg',
'',
'small'),
76 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_unchecked.svg',
'',
'small')
78 foreach ($this->
doSelect($order, $range) as $idx => $record) {
79 $row_id = (string) $record[
'usr_id'];
80 $record[
'achieve_txt'] = $record[
'achieve'] > 80 ?
'passed' :
'failed';
81 $record[
'failure_txt'] =
"not " . $record[
"achieve_txt"];
82 $record[
'repeat'] = $record[
'achieve'] < 80;
83 $record[
'achieve_icon'] = $icons[(
int) $record[
'achieve'] > 80];
84 yield $row_builder->buildDataRow($row_id, $record);
90 ?array $additional_parameters
98 $sql_order_part = $order->
join(
'ORDER BY', fn(...$o) => implode(
' ', $o));
99 $sql_range_part = sprintf(
'LIMIT %2$s OFFSET %1$s', ...$range->
unpack());
101 fn($rec) => array_merge($rec, [
'sql_order' => $sql_order_part,
'sql_range' => $sql_range_part]),
111 'usr_id' =>
$f->table()->column()->number(
"User ID")
112 ->withIsSortable(
false),
113 'login' =>
$f->table()->column()->text(
"Login")
114 ->withHighlight(
true),
115 'email' =>
$f->table()->column()->eMail(
"eMail"),
116 'last' =>
$f->table()->column()->date(
"last login", $this->df->dateFormat()->germanLong()),
117 'achieve' =>
$f->table()->column()->status(
"progress")
118 ->withIsOptional(
true),
119 'achieve_txt' =>
$f->table()->column()->status(
"success")
120 ->withIsSortable(
false)
121 ->withIsOptional(
true),
122 'failure_txt' =>
$f->table()->column()->status(
"failure")
123 ->withIsSortable(
false)
124 ->withIsOptional(
true,
false),
125 'achieve_icon' =>
$f->table()->column()->statusIcon(
"achieved")
126 ->withIsOptional(
true),
127 'repeat' =>
$f->table()->column()->boolean(
"repeat",
'yes',
'no')
128 ->withIsSortable(
false),
129 'fee' =>
$f->table()->column()->number(
"Fee")
131 ->withUnit(
'£',
I\Column\Number::UNIT_POSITION_FORE),
132 'sql_order' =>
$f->table()->column()->text(
"sql order part")
133 ->withIsSortable(
false)
134 ->withIsOptional(
true),
135 'sql_range' =>
$f->table()->column()->text(
"sql range part")
136 ->withIsSortable(
false)
137 ->withIsOptional(
true)
144 [
'usr_id' => 123,
'login' =>
'superuser',
'email' =>
'user@example.com',
145 'last' => new \DateTimeImmutable(),
'achieve' => 20,
'fee' => 0
147 [
'usr_id' => 867,
'login' =>
'student1',
'email' =>
'student1@example.com',
148 'last' => new \DateTimeImmutable(),
'achieve' => 90,
'fee' => 40
150 [
'usr_id' => 8923,
'login' =>
'student2',
'email' =>
'student2@example.com',
151 'last' => new \DateTimeImmutable(),
'achieve' => 66,
'fee' => 36.789
153 [
'usr_id' => 8748,
'login' =>
'student3_longname',
'email' =>
'student3_long_email@example.com',
154 'last' => new \DateTimeImmutable(),
'achieve' => 66,
'fee' => 36.789
getTableForRepresentation()
join($init, callable $fn)
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getColumsForRepresentation()
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Both the subject and the direction need to be specified when expressing an order. ...
repo_implementation()
expected output: > ILIAS shows the rendered Component.
getRows(I\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
ILIAS UI Factory $ui_factory
doSelect(Order $order, Range $range)
A simple class to express a naive range of whole positive numbers.