ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
base.php
Go to the documentation of this file.
1 <?php
2 function base()
3 {
4  global $DIC;
5  $f = $DIC->ui()->factory();
6  $renderer = $DIC->ui()->renderer();
7 
8  //build viewcontrols
9  $actions = array("All" => "#", "Upcoming events" => "#");
10  $aria_label = "filter entries";
11  $view_controls = array(
12  $f->viewControl()->mode($actions, $aria_label)->withActive("All")
13  );
14 
15  //build table
16  $ptable = $f->table()->presentation(
17  'Presentation Table', //title
18  $view_controls,
19  function ($row, $record, $ui_factory, $environment) { //mapping-closure
20  return $row
21  ->withHeadline($record['title'])
22  ->withSubheadline($record['type'])
23  ->withImportantFields(
24  array(
25  $record['begin_date'],
26  $record['location'],
27  'Available Slots: ' => $record['bookings_available']
28  )
29  )
30 
31  ->withContent(
32  $ui_factory->listing()->descriptive(
33  array(
34  'Targetgroup' => $record['target_group'],
35  'Goals' => $record['goals'],
36  'Topics' => $record['topics']
37  )
38  )
39  )
40 
41  ->withFurtherFieldsHeadline('Detailed Information')
42  ->withFurtherFields(
43  array(
44  'Location: ' => $record['location'],
45  $record['address'],
46  'Date: ' => $record['date'],
47  'Available Slots: ' => $record['bookings_available'],
48  'Fee: ' => $record['fee']
49  )
50  )
51  ->withAction(
52  $ui_factory->button()->standard('book course', '#')
53  );
54  }
55  );
56 
57  //example data as from an assoc-query, list of arrays (see below)
58  require('included_data.php');
59  $data = included_data();
60 
61  //apply data to table and render
62  return $renderer->render($ptable->withData($data));
63 }
global $DIC
Definition: saml.php:7
base()
Definition: base.php:2
$row
$data
Definition: bench.php:6
included_data()