ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
base1.php
Go to the documentation of this file.
1<?php
2function base1()
3{
4 global $DIC;
5 $f = $DIC->ui()->factory();
6 $renderer = $DIC->ui()->renderer();
7
8 //build viewcontrols
9 $actions = array("Alle" => "#", "Mehr als 5 Antworten" => "#");
10 $aria_label = "filter entries";
11 $view_controls = array(
12 $f->viewControl()->mode($actions, $aria_label)->withActive("Alle")
13 );
14
15 $mapping_closure = function ($row, $record, $ui_factory, $environment) {
16 return $row
17 ->withHeadline($record['question_title'])
18 ->withSubheadline($record['question_txt'])
19 ->withImportantFields(
20 array(
21 $record['type'],
22 'Beantwortet: ' => $record['stats']['total'],
23 'Häufigste Antwort: ' => $record['answers'][$record['stats']['most_common']]['title']
24 )
25 )
26 ->withContent(
27 $ui_factory->listing()->descriptive(
28 array(
29 'Werte' => $environment['totals']($record['answers']),
30 'Chart' => $environment['chart']($record['answers']),
31 )
32 )
33 )
34 ->withFurtherFieldsHeadline($record['type'])
35 ->withFurtherFields(
36 array(
37 'Beantwortet: ' => $record['stats']['total'],
38 'Übersprungen' => $record['stats']['skipped'],
39 'Häufigste Antwort: ' => $record['answers'][$record['stats']['most_common']]['title'],
40 'Anzahl Häufigste: ' => $record['stats']['most_common_total'],
41 'Median: ' => $record['answers'][$record['stats']['median']]['title']
42 )
43 )
44 ->withAction($ui_factory->button()->standard('zur Frage', '#'));
45 };
46
47
48 //build table
49 require('environment.php');
50
51 $ptable = $f->table()->presentation(
52 'Presentation Table', //title
53 $view_controls,
54 $mapping_closure
55 )
56 ->withEnvironment(environment());
57
58 //example data
59 require('included_data1.php');
61
62 //apply data to table and render
63 return $renderer->render($ptable->withData($data));
64}
base1()
Definition: base1.php:2
An exception for terminatinating execution or to throw for unit testing.
environment()
Definition: environment.php:3
included_data1()
$data
Definition: storeScorm.php:23
$DIC
Definition: xapitoken.php:46