ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
base1.php
Go to the documentation of this file.
1 <?php
2 function 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 }
included_data1()
global $DIC
Definition: saml.php:7
environment()
Definition: environment.php:3
$row
base1()
Definition: base1.php:2
$data
Definition: bench.php:6