ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Presentation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 use Closure;
29 
30 class Presentation extends Table implements T\Presentation
31 {
32  use ComponentHelper;
33  use HasViewControls;
35 
39  private array $environment = [];
40 
41  private array $records;
44 
45 
46  public function __construct(
47  string $title,
48  array $view_controls,
49  Closure $row_mapping,
50  SignalGeneratorInterface $signal_generator
51  ) {
52  $this->title = $title;
53  $this->view_controls = $view_controls;
54  $this->row_mapping = $row_mapping;
55  $this->signal_generator = $signal_generator;
56  }
57 
59  {
61  }
62 
66  public function withRowMapping(Closure $row_mapping): T\Presentation
67  {
68  $clone = clone $this;
69  $clone->row_mapping = $row_mapping;
70  return $clone;
71  }
72 
76  public function getRowMapping(): Closure
77  {
78  return $this->row_mapping;
79  }
80 
84  public function withEnvironment(array $environment): T\Presentation
85  {
86  $clone = clone $this;
87  $clone->environment = $environment;
88  return $clone;
89  }
90 
94  public function getEnvironment(): array
95  {
96  return $this->environment;
97  }
98 
102  public function withData(array $records): T\Presentation
103  {
104  $clone = clone $this;
105  $clone->records = $records;
106  return $clone;
107  }
108 
112  public function getData(): array
113  {
114  return $this->records;
115  }
116 }
__construct(string $title, array $view_controls, Closure $row_mapping, SignalGeneratorInterface $signal_generator)
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
trait HasViewControls
Trait for panels supporting view controls.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withRowMapping(Closure $row_mapping)
Get a table like this with the closure $row_mapping.This closure is called by the renderer upon build...
withData(array $records)
Fill a recordset into the table.All elements in $records MUST be processable by the mapping-closure...
getData()
Get the recordset of this table.All elements in $records MUST be processable by the mapping-closure...
This describes a Presentation Table.
withEnvironment(array $environment)
Add a list of additional things the mapping-closure needs for processing.These can be virtually anyth...
getEnvironment()
Get an array of additionally needed elements to build a data-entry.array<string,mixed> ...
getRowMapping()
Get the closure to construct row-entries with.