3declare(strict_types=1);
12use Psr\Http\Message\ServerRequestInterface;
35 $r =
$DIC[
'ui.renderer'];
36 $df = new \ILIAS\Data\Factory();
38 $request =
$DIC->http()->request();
41 'usr_id' =>
$f->table()->column()->number(
"User ID")
42 ->withIsSortable(
false),
43 'login' =>
$f->table()->column()->text(
"Login")
44 ->withIsOptional(
true)
45 ->withIsSortable(
false),
46 'email' =>
$f->table()->column()->eMail(
"eMail")
47 ->withIsOptional(
true)
48 ->withIsSortable(
false),
62 public function getRows(
64 array $visible_column_ids,
67 mixed $additional_viewcontrol_data,
69 mixed $additional_parameters
71 $records = $this->getRecords(
$range, $order);
72 foreach ($records as $idx => $record) {
73 $row_id = (string) $record[
'usr_id'];
75 if (in_array(
'hide_login', $additional_viewcontrol_data[0])) {
76 $record[
'login'] =
'-';
78 if (in_array(
'hide_mail', $additional_viewcontrol_data[0])) {
79 $record[
'email'] =
'-';
81 yield $row_builder->buildDataRow($row_id, $record);
85 public function getTotalRowCount(
86 mixed $additional_viewcontrol_data,
88 mixed $additional_parameters
90 return count($this->getRecords());
93 protected function getRecords(?
Range $range =
null, ?
Order $order =
null): array
96 [
'usr_id' => 123,
'login' =>
'superuser',
'email' =>
'user@example.com',
97 'last' => (new \DateTimeImmutable())->modify(
'-1 day') ,
'achieve' => 20,
'fee' => 0
99 [
'usr_id' => 867,
'login' =>
'student1',
'email' =>
'student1@example.com',
100 'last' => (new \DateTimeImmutable())->modify(
'-10 day'),
'achieve' => 90,
'fee' => 40
102 [
'usr_id' => 8923,
'login' =>
'student2',
'email' =>
'student2@example.com',
103 'last' => (new \DateTimeImmutable())->modify(
'-8 day'),
'achieve' => 66,
'fee' => 36.789
112 'a data table with additional view controls',
118 ->withAdditionalViewControl(
119 $f->input()->viewControl()->group(
121 $f->input()->viewControl()->mode([
122 'show_login' =>
'show login',
123 'hide_login' =>
'anon login'
125 ->withValue(
'show_login'),
127 $f->input()->viewControl()->mode([
128 'show_mail' =>
'show mails',
129 'hide_mail' =>
'anon mails'
131 ->withValue(
'show_mail'),
133 $f->input()->viewControl()->fieldSelection([
134 'opt1' =>
'option 1',
135 'opt2' =>
'option 2',
136 'opt3' =>
'option 3',
138 $f->input()->viewControl()->fieldSelection([
139 'opt1' =>
'option 1',
140 'opt2' =>
'option 2',
141 'opt3' =>
'option 3',
144 $f->input()->viewControl()->sortation([
145 'Field 1, ascending' =>
new Order(
'field1',
'ASC'),
146 'Field 1, descending' =>
new Order(
'field1',
'DESC'),
148 $f->input()->viewControl()->sortation([
149 'Field 1, ascending' =>
new Order(
'field1',
'ASC'),
150 'Field 1, descending' =>
new Order(
'field1',
'DESC'),
156 ->withRequest($request);
158 return $r->render($table->withId(
'_addvc_example'));
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
__construct()
Constructor setup ILIAS global object @access public.
An entity that renders components to a string output.
with_additional_viewcontrols()
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.