ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Presentation.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
5 
9 
10 class Presentation implements T\Presentation
11 {
12  use ComponentHelper;
13 
17  protected $signal_generator;
18 
22  private $title;
23 
27  private $view_controls;
28 
32  private $row_mapping;
33 
37  private $records;
38 
42  private $environment;
43 
44 
45 
47  {
48  $this->checkStringArg("string", $title);
49  $this->title = $title;
50  $this->view_controls = $view_controls;
51  $this->row_mapping = $row_mapping;
52  $this->signal_generator = $signal_generator;
53  }
54 
58  public function getSignalGenerator()
59  {
61  }
62 
66  public function withTitle($title)
67  {
68  $this->checkStringArg("string", $title);
69  $clone = clone $this;
70  $clone->title = $title;
71  ;
72  return $clone;
73  }
74 
78  public function getTitle()
79  {
80  return $this->title;
81  }
82 
86  public function withViewControls(array $view_controls)
87  {
88  $clone = clone $this;
89  $clone->view_controls = $view_controls;
90  ;
91  return $clone;
92  }
93 
97  public function getViewControls()
98  {
99  return $this->view_controls;
100  }
101 
106  {
107  $clone = clone $this;
108  $clone->row_mapping = $row_mapping;
109  ;
110  return $clone;
111  }
112 
116  public function getRowMapping()
117  {
118  return $this->row_mapping;
119  }
120 
124  public function withEnvironment(array $environment)
125  {
126  $clone = clone $this;
127  $clone->environment = $environment;
128  return $clone;
129  }
130 
134  public function getEnvironment()
135  {
136  return $this->environment;
137  }
138 
142  public function withData(array $records)
143  {
144  $clone = clone $this;
145  $clone->records = $records;
146  ;
147  return $clone;
148  }
149 
153  public function getData()
154  {
155  return $this->records;
156  }
157 }
getViewControls()
Get view controls to be shown in the header of the table.ILIAS[]
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
withRowMapping(\Closure $row_mapping)
Get a table like this with the closure $row_mapping.This closure is called by the renderer upon build...
__construct($title, array $view_controls, \Closure $row_mapping, SignalGeneratorInterface $signal_generator)
withViewControls(array $view_controls)
Get a table like this with these view controls.
withTitle($title)
Get a table like this with title $title.
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.
Definition: Presentation.php:9
withEnvironment(array $environment)
Add a list of additional things the mapping-closure needs for processing.These can be virtually anyth...
getTitle()
Get the title of the table.string
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.