ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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  /*
14  * Basic Construction
15  */
16 
17  $primary_id = "Building Better UX by Considering Information Architecture and User Intent";
18  $secondary_id = $f->symbol()->icon()->standard('crs', 'course icon', 'large');
19 
20  // creating the entity object now so it can be filled in the logic section
21  $entity = $f->entity()->standard(
22  $primary_id,
23  $secondary_id
24  );
25 
26  /*
27  * Dropdown Actions
28  */
29 
30  $actions = [
31  $f->button()->shy("ILIAS", "https://www.ilias.de"),
32  $f->button()->shy("GitHub", "https://www.github.com")
33  ];
34  $entity = $entity->withActions(...$actions);
35 
36  /*
37  * Logic for Pulling Availabilty Properties to Blocking Conditions
38  */
39 
40  $av_data = ['Available Seats' => 4, 'Available' => 'until 24.12.2023', 'Expected Preconditions' => 'UI Design 101', 'Passed Courses' => 'Painting'];
41 
42  $blocking = $f->listing()->property();
43  $availability = $f->listing()->property();
44 
45  $precondition_link = $f->link()->standard("Preconditions", "http://www.ilias.de");
46 
47  // If preconditions aren't met
48  $blocking = ($av_data['Expected Preconditions'] === $av_data['Passed Courses'])
49  ? $blocking : $blocking->withProperty("Preconditions", $precondition_link, false);
50 
51  // If no more seats are available
52  $blocking = ($av_data['Available Seats'] === 0)
53  ? $blocking->withProperty("Available Seats", (string)$av_data['Available Seats']) : $blocking;
54  $availability = ($av_data['Available Seats'] > 0)
55  ? $availability->withProperty("Available Seats", (string)$av_data['Available Seats']) : $availability;
56 
57  // all remaining availability properties
58  $availability = $availability->withProperty("Available", $av_data['Available']);
59 
60  $entity = $entity
61  ->withBlockingAvailabilityConditions($blocking)
62  ->withAvailability($availability);
63 
64  /*
65  * All Other Semantic Groups
66  */
67 
68  $reactions = [
69  $f->button()->tag('UX/UI', '#'), $f->button()->tag('First Semester', '#')
70  ];
71 
72  $details = $f->listing()->property()
73  ->withProperty('Duration', '90 minutes')
74  ->withProperty('Recording', 'recording available', false)
75  ;
76 
77  $status = $f->legacy(
78  $renderer->render($f->symbol()->icon()->custom('./templates/default/images/learning_progress/in_progress.svg', 'incomplete'))
79  . ' in progress'
80  );
81 
82  $entity = $entity
83  ->withPersonalStatus($status)
84  ->withDetails($details)
85  ->withReactions(...$reactions)
86  ;
87 
88  /*
89  * Priority Areas
90  */
91 
92  $featured_properties = $f->listing()->property()
93  ->withProperty('Event Date', '14.02.2023');
94 
95  $prio_reactions = [
96  $f->symbol()->glyph()->love()
97  ->withCounter($f->counter()->status(2)),
98  $f->symbol()->glyph()->comment()
99  ->withCounter($f->counter()->novelty(3))
100  ->withCounter($f->counter()->status(7))
101  ];
102 
103  $main_detail_1 = $f->listing()->property()
104  ->withProperty('Room', '7')
105  ;
106  $main_detail_2 = $f->listing()->property()
107  ->withProperty('Description', 'This lecture is an introduction to basic concepts fundamental for an intuitive user experience. These basic principles are not directly connected to the visual design, yet they help us to discover a hierarchy in relevance that needs to be respected for the visual appearance.', false)
108  ;
109 
110  $entity = $entity
111  ->withFeaturedProperties($featured_properties)
112  ->withMainDetails($main_detail_1, $main_detail_2)
113  ->withPrioritizedReactions(...$prio_reactions)
114  ;
115 
116  return $renderer->render($entity);
117 }
global $DIC
Definition: feed.php:28
array $details
Details for error message relating to last request processed.
Definition: System.php:109