Newer
Older
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
A library to create of an ILIAS-table
in the plugin context.
This Library is only usable in an ILIAS Plugin
on an ILIAS system.
## Usage
Create a new table class e.g. `Example.php` and
extend from the `ILIAS\PluginLibrary\Table`.
```php
class ExampleTable extends Table
{
public function __construct(
$a_parent_obj,
$a_parent_cmd
$a_template_context
Provider $provider
) {
// ...
parent::__construct(
$a_parent_obj,
$a_parent_cmd,
$a_template_context,
$context
);
}
protected function getTableId()
{
return 'example_table';
}
protected function prepareRow(array &$row)
{
parent::prepareRow($row);
}
protected function formatCellValue($column, array $row)
{
return parent::formatCellValue($column, $row);
}
protected function getColumnDefinition()
{
return array_filter(array(
1 => array(
'field' => 'id'
'txt' => $this->pluginObject->txt('id'),
'default' => true,
'optional' => false,
'sortable' => false
),
2 => array(
'field' => 'firstname',
'txt' => $this->pluginObject->txt('firstname'),
'default' => true,
'optional' => false,
'sortable' => true
),
);
}
}
```
### Provider
A `Provider` instance will be used to fill
the table rows.
The `array` MUST contain a `data` and `cnt` element
which will contain the row-data and the concrete
count of rows that will be displayed.
Example:
```php
array(
'data' => array(
array(
'usr_id' => 70,
'firstname' => 'Niels',
'lastname' => 'Theen'
),
array(
'usr_id' => 80,
'firstname' => 'Michael',
'lastname' => 'Jansen'
),
),
'cnt' => 2
)
```