# ILIAS-Plugin Table 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 ) ```