3 declare(strict_types=1);
27 $ui_factory = $DIC->ui()->factory();
30 $target = $DIC->http()->request()->getRequestTarget();
34 $tpl->addCss(
'src/UI/examples/Table/Presentation/presentation_alignment_example.css');
40 $aria_label =
"filter entries";
41 $active_view_control =
'Alle';
43 "Alle" => $target .
'&all=1',
44 "Mehr als 5 Antworten" => $target .
'&all=0' 48 $active_view_control =
'Mehr als 5 Antworten';
50 $view_controls = array(
51 $ui_factory->viewControl()->mode($actions, $aria_label)->withActive($active_view_control)
55 $modal = $ui_factory->modal()->interruptive(
'zur Frage',
'This is just an example',
'#')
56 ->withActionButtonLabel(
'Go');
58 $mapping_closure =
function ($row, $record, $ui_factory, $environment) use ($modal) {
60 ->withHeadline($record[
'question_title'])
62 $ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_ques.svg',
'')
64 ->withSubheadline($record[
'question_txt'])
65 ->withImportantFields(
68 'Beantwortet: ' => $record[
'stats'][
'total'],
69 'Häufigste Antwort: ' => $record[
'answers'][$record[
'stats'][
'most_common']][
'title']
73 $ui_factory->layout()->alignment()->horizontal()->dynamicallyDistributed(
74 $ui_factory->layout()->alignment()->vertical(
75 $ui_factory->listing()->descriptive([
76 'Werte' => $environment[
'totals']($record[
'answers'])
78 $ui_factory->listing()->descriptive([
79 'Chart' => $environment[
'chart']($record[
'answers'])
82 $ui_factory->listing()->descriptive([
83 '' => $environment[
'stats']($record)
88 $ui_factory->button()->standard(
'zur Frage',
'#')
89 ->withOnClick($modal->getShowSignal())
93 $ptable = $ui_factory->table()->presentation(
94 'Presentation Table with Alignments',
104 $ptable->withData(
$data)
110 $totals =
function ($answers) {
111 $ret =
'<div class="example_block content"><table>';
112 $ret .=
'<tr><td></td>' 114 .
'<td style="padding-left: 10px;">Proportion</td></tr>';
116 foreach ($answers as $answer) {
118 .
'<td style="padding-right: 10px;">' . $answer[
'title'] .
'</td>' 119 .
'<td style="text-align:right">' . $answer[
'amount'] .
'</td>' 120 .
'<td style="text-align:right">' . $answer[
'proportion'] .
'%</td>' 124 $ret .=
'</table></div>';
128 $chart =
function ($answers) {
129 $ret =
'<div class="example_block content"><table style="width:100%">';
130 foreach ($answers as $answer) {
131 $ret .=
'<tr style="border-bottom: 1px solid black;">' 132 .
'<td style="width: 200px;">' 135 .
'<div style="background-color:grey; height:20px; width:' . $answer[
'proportion'] .
'%;"></div>' 138 $ret .=
'</table></div>';
142 $stats =
function ($answers) {
144 $ui_factory = $DIC->ui()->factory();
145 $ui_renderer = $DIC->ui()->renderer();
147 $icon = $ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_ques.svg',
'');
149 $ret =
'<div class="example_block stats">';
150 $ret .=
'<h5>' . $ui_renderer->render($icon) .
' ' . $answers[
'type'] .
'</h5>';
151 $ret .=
'<span class="c-stats--title">Beantwortet:</span> ' 152 . $answers[
'stats'][
'total'] .
'<br>' 153 .
'<span class="c-stats--title">Übersprungen:</span> ' 154 . $answers[
'stats'][
'skipped'] .
'<br>' 155 .
'<span class="c-stats--title">Häufigste Antwort:</span> ' 156 . $answers[
'answers'][$answers[
'stats'][
'most_common']][
'title'] .
'<br>' 157 .
'<span class="c-stats--title">Anzahl Häufigste:</span> ' 158 . $answers[
'stats'][
'most_common_total'] .
'<br>' 159 .
'<span class="c-stats--title">Median:</span> ' 160 . $answers[
'answers'][$answers[
'stats'][
'median']][
'title'];
176 'type' =>
'Single Choice Frage',
177 'question_title' =>
'Belastbarkeit',
178 'question_txt' =>
'Wie ausgeprägt ist die Belastbarkeit des / der Auszubildenden?',
180 array(
'title' =>
'weniger ausgeprägt',
'amount' => 2,
'proportion' => 20),
181 array(
'title' =>
'teilweise ausgeprägt',
'amount' => 0,
'proportion' => 0),
182 array(
'title' =>
'ausgeprägt',
'amount' => 6,
'proportion' => 60),
183 array(
'title' =>
'deutlich ausgeprägt',
'amount' => 1,
'proportion' => 10),
184 array(
'title' =>
'stark ausgeprägt',
'amount' => 0,
'proportion' => 0),
185 array(
'title' =>
'sehr stark ausgeprägt',
'amount' => 0,
'proportion' => 0),
186 array(
'title' =>
'übermäßig ausgeprägt',
'amount' => 1,
'proportion' => 10)
192 'most_common_total' => 6,
198 'type' =>
'Single Choice Frage',
199 'question_title' =>
'Dialogfähigkeit, Kundenorientierung, Beratungsfähigkeit',
200 'question_txt' =>
'Wie ausgeprägt ist die Dialogfähigkeit, Kundenorientierung und Beratungsfähigkeit des / der Auszubildenden?',
202 array(
'title' =>
'weniger ausgeprägt',
'amount' => 0,
'proportion' => 0),
203 array(
'title' =>
'teilweise ausgeprägt',
'amount' => 1,
'proportion' => 100),
204 array(
'title' =>
'ausgeprägt',
'amount' => 0,
'proportion' => 0),
205 array(
'title' =>
'deutlich ausgeprägt',
'amount' => 0,
'proportion' => 0),
206 array(
'title' =>
'stark ausgeprägt',
'amount' => 0,
'proportion' => 0),
207 array(
'title' =>
'sehr stark ausgeprägt',
'amount' => 0,
'proportion' => 0),
208 array(
'title' =>
'übermäßig ausgeprägt',
'amount' => 0,
'proportion' => 0)
214 'most_common_total' => 1,
base1()
description: > Example for rendering a presentation table.