ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
29 function base()
30 {
31  global $DIC;
32  $f = $DIC->ui()->factory();
33  $renderer = $DIC->ui()->renderer();
34 
35  /*
36  * Basic Construction
37  */
38 
39  $primary_id = "Building Better UX by Considering Information Architecture and User Intent";
40  $secondary_id = $f->symbol()->icon()->standard('crs', 'course icon', 'large');
41 
42  // creating the entity object now so it can be filled in the logic section
43  $entity = $f->entity()->standard(
44  $primary_id,
45  $secondary_id
46  );
47 
48  /*
49  * Dropdown Actions
50  */
51 
52  $actions = [
53  $f->button()->shy("ILIAS", "https://www.ilias.de"),
54  $f->button()->shy("GitHub", "https://www.github.com")
55  ];
56  $entity = $entity->withActions(...$actions);
57 
58  /*
59  * Logic for Pulling Availabilty Properties to Blocking Conditions
60  */
61 
62  $av_data = ['Available Seats' => 4, 'Available' => 'until 24.12.2023', 'Expected Preconditions' => 'UI Design 101', 'Passed Courses' => 'Painting'];
63 
64  $blocking = $f->listing()->property();
65  $availability = $f->listing()->property();
66 
67  $precondition_link = $f->link()->standard("Preconditions", "http://www.ilias.de");
68 
69  // If preconditions aren't met
70  $blocking = ($av_data['Expected Preconditions'] === $av_data['Passed Courses'])
71  ? $blocking : $blocking->withProperty("Preconditions", $precondition_link, false);
72 
73  // If no more seats are available
74  $blocking = ($av_data['Available Seats'] === 0)
75  ? $blocking->withProperty("Available Seats", (string) $av_data['Available Seats']) : $blocking;
76  $availability = ($av_data['Available Seats'] > 0)
77  ? $availability->withProperty("Available Seats", (string) $av_data['Available Seats']) : $availability;
78 
79  // all remaining availability properties
80  $availability = $availability->withProperty("Available", $av_data['Available']);
81 
82  $entity = $entity
83  ->withBlockingAvailabilityConditions($blocking)
84  ->withAvailability($availability);
85 
86  /*
87  * All Other Semantic Groups
88  */
89 
90  $reactions = [
91  $f->button()->tag('UX/UI', '#'), $f->button()->tag('First Semester', '#')
92  ];
93 
94  $details = $f->listing()->property()
95  ->withProperty('Duration', '90 minutes')
96  ->withProperty('Recording', 'recording available', false)
97  ;
98 
99  $status = $f->legacy(
100  $renderer->render($f->symbol()->icon()->custom('./assets/images/learning_progress/in_progress.svg', 'incomplete'))
101  . ' in progress'
102  );
103 
104  $entity = $entity
105  ->withPersonalStatus($status)
106  ->withDetails($details)
107  ->withReactions(...$reactions)
108  ;
109 
110  /*
111  * Priority Areas
112  */
113 
114  $featured_properties = $f->listing()->property()
115  ->withProperty('Event Date', '14.02.2023');
116 
117  $prio_reactions = [
118  $f->symbol()->glyph()->love()
119  ->withCounter($f->counter()->status(2)),
120  $f->symbol()->glyph()->comment()
121  ->withCounter($f->counter()->novelty(3))
122  ->withCounter($f->counter()->status(7))
123  ];
124 
125  $main_detail_1 = $f->listing()->property()
126  ->withProperty('Room', '7')
127  ;
128  $main_detail_2 = $f->listing()->property()
129  ->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)
130  ;
131 
132  $entity = $entity
133  ->withFeaturedProperties($featured_properties)
134  ->withMainDetails($main_detail_1, $main_detail_2)
135  ->withPrioritizedReactions(...$prio_reactions)
136  ;
137 
138  return $renderer->render($entity);
139 }
$renderer
global $DIC
Definition: shib_login.php:25
base()
expected output: > Entities arrange information about e.g.
Definition: base.php:29