ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 function base()
8 {
9  global $DIC;
10  $f = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12 
13  //build viewcontrols
14  $actions = array("All" => "#", "Upcoming events" => "#");
15  $aria_label = "filter entries";
16  $view_controls = array(
17  $f->viewControl()->mode($actions, $aria_label)->withActive("All")
18  );
19 
20  //build table
21  $ptable = $f->table()->presentation(
22  'Presentation Table', //title
23  $view_controls,
24  function ($row, $record, $ui_factory, $environment) { //mapping-closure
25  return $row
26  ->withHeadline($record['title'])
27  ->withSubheadline($record['type'])
28  ->withImportantFields(
29  array(
30  $record['begin_date'],
31  $record['location'],
32  'Available Slots: ' => $record['bookings_available']
33  )
34  )
35 
36  ->withContent(
37  $ui_factory->listing()->descriptive(
38  array(
39  'Targetgroup' => $record['target_group'],
40  'Goals' => $record['goals'],
41  'Topics' => $record['topics']
42  )
43  )
44  )
45 
46  ->withFurtherFieldsHeadline('Detailed Information')
47  ->withFurtherFields(
48  array(
49  'Location: ' => $record['location'],
50  $record['address'],
51  'Date: ' => $record['date'],
52  'Available Slots: ' => $record['bookings_available'],
53  'Fee: ' => $record['fee']
54  )
55  )
56  ->withAction(
57  $ui_factory->button()->standard('book course', '#')
58  );
59  }
60  );
61 
62  //example data as from an assoc-query, list of arrays
63  $data = included_data();
64 
65  //apply data to table and render
66  return $renderer->render($ptable->withData($data));
67 }
68 
69 function included_data()
70 {
71  return array(
72  array(
73  'title' => 'Online Presentation of some Insurance Topic',
74  'type' => 'Webinar',
75  'begin_date' => '30.09.2017',
76  'bookings_available' => '3',
77  'target_group' => 'Employees, Field Service',
78  'goals' => 'Lorem Ipsum....',
79  'topics' => '<li>Tranportations</li><li>Europapolice</li>',
80  'date' => '30.09.2017 - 02.10.2017',
81  'location' => 'Hamburg',
82  'address' => 'Hauptstraße 123',
83  'fee' => '380 €'
84  ),
85  array(
86  'title' => 'Workshop: Life Insurance 2017',
87  'type' => 'Face 2 Face',
88  'begin_date' => '12.12.2017',
89  'bookings_available' => '12',
90  'target_group' => 'Agencies, Field Service',
91  'goals' => 'Life insurance (or life assurance, especially in the Commonwealth of Nations), is a contract between an insurance policy holder and an insurer or assurer, where the insurer promises to pay a designated beneficiary a sum of money (the benefit) in exchange for a premium, upon the death of an insured person (often the policy holder). Depending on the contract, other events such as terminal illness or critical illness can also trigger payment. The policy holder typically pays a premium, either regularly or as one lump sum. Other expenses (such as funeral expenses) can also be included in the benefits.',
92  'topics' => 'Life-based contracts tend to fall into two major categories:
93  <ul><li>Protection policies – designed to provide a benefit, typically a lump sum payment, in the event of a specified occurrence. A common form - more common in years past - of a protection policy design is term insurance.</li>
94  <li>Investment policies – the main objective of these policies is to facilitate the growth of capital by regular or single premiums. Common forms (in the U.S.) are whole life, universal life, and variable life policies.</li></ul>',
95  'date' => '12.12.2017 - 14.12.2017',
96  'location' => 'Cologne',
97  'address' => 'Holiday Inn, Am Dom 12, 50667 Köln',
98  'fee' => '500 €'
99  ),
100  array(
101  'title' => 'Basics: Preparation for Seminars',
102  'type' => 'Online Training',
103  'begin_date' => '-',
104  'bookings_available' => 'unlimited',
105  'target_group' => 'All',
106  'goals' => '',
107  'topics' => '',
108  'date' => '-',
109  'location' => 'online',
110  'address' => '',
111  'fee' => '-'
112  )
113  );
114 }
global $DIC
Definition: feed.php:28