3 declare(strict_types=1);
27 $r = $DIC[
'ui.renderer'];
30 $table = $repo->getTableForRepresentation();
33 $table->withRequest($DIC->http()->request())
40 protected \ILIAS\Data\Factory
$df;
46 $this->ui_factory = $DIC[
'ui.factory'];
47 $this->df = new \ILIAS\Data\Factory();
48 $this->current_user_date_format = $this->df->dateFormat()->withTime24(
49 $DIC[
'ilUser']->getDateFormat()
56 return $this->ui_factory->table()->data(
57 'a data table from a repository',
66 array $visible_column_ids,
70 ?array $additional_parameters
73 $this->ui_factory->symbol()->icon()->custom(
'templates/default/images/standard/icon_checked.svg',
'',
'small'),
74 $this->ui_factory->symbol()->icon()->custom(
'templates/default/images/standard/icon_unchecked.svg',
'',
'small')
76 foreach ($this->
doSelect($order, $range) as $idx => $record) {
77 $row_id = (string) $record[
'usr_id'];
78 $record[
'achieve_txt'] = $record[
'achieve'] > 80 ?
'passed' :
'failed';
79 $record[
'failure_txt'] =
"not " . $record[
"achieve_txt"];
80 $record[
'repeat'] = $record[
'achieve'] < 80;
81 $record[
'achieve_icon'] = $icons[(
int) $record[
'achieve'] > 80];
82 yield $row_builder->buildDataRow($row_id, $record);
88 ?array $additional_parameters
96 $sql_order_part = $order->
join(
'ORDER BY', fn(...$o) => implode(
' ', $o));
97 $sql_range_part = sprintf(
'LIMIT %2$s OFFSET %1$s', ...$range->
unpack());
99 fn($rec) => array_merge($rec, [
'sql_order' => $sql_order_part,
'sql_range' => $sql_range_part]),
109 'usr_id' =>
$f->table()->column()->number(
"User ID")
110 ->withIsSortable(
false),
111 'login' =>
$f->table()->column()->text(
"Login")
112 ->withHighlight(
true),
113 'email' =>
$f->table()->column()->eMail(
"eMail"),
114 'last' =>
$f->table()->column()->date(
"last login", $this->current_user_date_format),
115 'achieve' =>
$f->table()->column()->status(
"progress")
116 ->withIsOptional(
true),
117 'achieve_txt' =>
$f->table()->column()->status(
"success")
118 ->withIsSortable(
false)
119 ->withIsOptional(
true),
120 'failure_txt' =>
$f->table()->column()->status(
"failure")
121 ->withIsSortable(
false)
122 ->withIsOptional(
true,
false),
123 'achieve_icon' =>
$f->table()->column()->statusIcon(
"achieved")
124 ->withIsOptional(
true),
125 'repeat' =>
$f->table()->column()->boolean(
"repeat",
'yes',
'no')
126 ->withIsSortable(
false),
127 'fee' =>
$f->table()->column()->number(
"Fee")
129 ->withUnit(
'£',
I\
Column\Number::UNIT_POSITION_FORE),
130 'sql_order' =>
$f->table()->column()->text(
"sql order part")
131 ->withIsSortable(
false)
132 ->withIsOptional(
true),
133 'sql_range' =>
$f->table()->column()->text(
"sql range part")
134 ->withIsSortable(
false)
135 ->withIsOptional(
true)
142 [
'usr_id' => 123,
'login' =>
'superuser',
'email' =>
'user@example.com',
143 'last' => new \DateTimeImmutable(),
'achieve' => 20,
'fee' => 0
145 [
'usr_id' => 867,
'login' =>
'student1',
'email' =>
'student1@example.com',
146 'last' => new \DateTimeImmutable(),
'achieve' => 90,
'fee' => 40
148 [
'usr_id' => 8923,
'login' =>
'student2',
'email' =>
'student2@example.com',
149 'last' => new \DateTimeImmutable(),
'achieve' => 66,
'fee' => 36.789
151 [
'usr_id' => 8748,
'login' =>
'student3_longname',
'email' =>
'student3_long_email@example.com',
152 'last' => new \DateTimeImmutable(),
'achieve' => 66,
'fee' => 36.789
getTableForRepresentation()
join($init, callable $fn)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
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. ...
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)
ILIAS Data DateFormat DateFormat $current_user_date_format
A simple class to express a range of whole positive numbers.