PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / EventFeedbackFormTemplate.php

EventFeedbackFormTemplate.php in The Innovative Form Builder – IvyForms 0.9, at backend/src/Services/Template/EventFeedbackFormTemplate.php

332 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 // phpcs:disable PSR1.Files.SideEffects
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 use IvyForms\Services\Translations\BackendStrings;
11
12 class EventFeedbackFormTemplate
13 {
14 /**
15 * Get the Event Feedback Form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'event_feedback_form',
23 'name' => BackendStrings::getTemplateStrings()['event_feedback_form'],
24 'description' => BackendStrings::getTemplateStrings()['event_feedback_form_desc'],
25 'category' => 'feedback-forms',
26 'subcategory' => 'event-feedback-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'event-feedback-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['event_feedback_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getEventTypeDropdownField(),
37 self::getExpectationsRadioField(),
38 self::getOverallSatisfactionRatingField(),
39 self::getAspectsCheckboxField(),
40 self::getAdditionalCommentsTextareaField(),
41 self::getEmailField()
42 ),
43 'settings' => []
44 ]
45 ];
46 }
47
48 /**
49 * Event type dropdown field
50 *
51 * @return array<int, array<string, mixed>>
52 */
53 private static function getEventTypeDropdownField(): array
54 {
55 return [[
56 'id' => 7,
57 'fieldIndex' => 1,
58 'type' => 'select',
59 'label' => BackendStrings::getTemplateStrings()['event_type'],
60 'placeholder' => BackendStrings::getTemplateStrings()['select_event_type'],
61 'required' => true,
62 'parentId' => null,
63 'defaultValue' => '',
64 'position' => 1,
65 'fieldOptions' => [
66 [
67 'id' => 1,
68 'label' => BackendStrings::getTemplateStrings()['conference'],
69 'value' => 'conference',
70 'isDefault' => false,
71 'position' => 1,
72 ],
73 [
74 'id' => 2,
75 'label' => BackendStrings::getTemplateStrings()['workshop'],
76 'value' => 'workshop',
77 'isDefault' => false,
78 'position' => 2,
79 ],
80 [
81 'id' => 3,
82 'label' => BackendStrings::getTemplateStrings()['webinar'],
83 'value' => 'webinar',
84 'isDefault' => false,
85 'position' => 3,
86 ],
87 [
88 'id' => 4,
89 'label' => BackendStrings::getTemplateStrings()['networking_event'],
90 'value' => 'networking_event',
91 'isDefault' => false,
92 'position' => 4,
93 ],
94 [
95 'id' => 5,
96 'label' => BackendStrings::getTemplateStrings()['training'],
97 'value' => 'training',
98 'isDefault' => false,
99 'position' => 5,
100 ],
101 [
102 'id' => 6,
103 'label' => BackendStrings::getTemplateStrings()['other'],
104 'value' => 'other',
105 'isDefault' => false,
106 'position' => 6,
107 ],
108 ]
109 ]];
110 }
111
112 /**
113 * Expectations radio field
114 *
115 * @return array<int, array<string, mixed>>
116 */
117 private static function getExpectationsRadioField(): array
118 {
119 return [[
120 'id' => 12,
121 'fieldIndex' => 2,
122 'type' => 'radio',
123 'label' => BackendStrings::getTemplateStrings()['did_meet_expectations'],
124 'required' => true,
125 'parentId' => null,
126 'defaultValue' => '',
127 'placeholder' => '',
128 'position' => 2,
129 'fieldOptions' => [
130 [
131 'id' => 8,
132 'label' => BackendStrings::getTemplateStrings()['exceeded_expectations'],
133 'value' => 'exceeded_expectations',
134 'isDefault' => false,
135 'position' => 1,
136 ],
137 [
138 'id' => 9,
139 'label' => BackendStrings::getTemplateStrings()['met_expectations'],
140 'value' => 'met_expectations',
141 'isDefault' => false,
142 'position' => 2,
143 ],
144 [
145 'id' => 10,
146 'label' => BackendStrings::getTemplateStrings()['partially_met_expectations'],
147 'value' => 'partially_met_expectations',
148 'isDefault' => false,
149 'position' => 3,
150 ],
151 [
152 'id' => 11,
153 'label' => BackendStrings::getTemplateStrings()['did_not_meet_expectations'],
154 'value' => 'did_not_meet_expectations',
155 'isDefault' => false,
156 'position' => 4,
157 ],
158 ]
159 ]];
160 }
161
162 /**
163 * Overall satisfaction rating field
164 *
165 * @return array<int, array<string, mixed>>
166 */
167 private static function getOverallSatisfactionRatingField(): array
168 {
169 return [[
170 'id' => 13,
171 'fieldIndex' => 3,
172 'type' => 'rating',
173 'label' => BackendStrings::getTemplateStrings()['overall_event_satisfaction'],
174 'description' => '',
175 'required' => true,
176 'defaultValue' => '',
177 'placeholder' => '',
178 'position' => 3,
179 'labelPosition' => 'default',
180 'ratingIcon' => 'star',
181 'fieldOptions' => self::getStandardRatingOptions(11),
182 'showValues' => false,
183 'showRatingText' => true,
184 ]];
185 }
186
187 /**
188 * Aspects checkbox field
189 *
190 * @return array<int, array<string, mixed>>
191 */
192 private static function getAspectsCheckboxField(): array
193 {
194 return [[
195 'id' => 19,
196 'fieldIndex' => 4,
197 'type' => 'checkbox',
198 'label' => BackendStrings::getTemplateStrings()['aspects_stood_out'],
199 'required' => false,
200 'parentId' => null,
201 'defaultValue' => '',
202 'placeholder' => '',
203 'position' => 4,
204 'fieldOptions' => [
205 [
206 'id' => 14,
207 'label' => BackendStrings::getTemplateStrings()['content_quality'],
208 'value' => 'content_quality',
209 'isDefault' => false,
210 'position' => 1,
211 ],
212 [
213 'id' => 15,
214 'label' => BackendStrings::getTemplateStrings()['speakers_or_hosts'],
215 'value' => 'speakers_or_hosts',
216 'isDefault' => false,
217 'position' => 2,
218 ],
219 [
220 'id' => 16,
221 'label' => BackendStrings::getTemplateStrings()['organization'],
222 'value' => 'organization',
223 'isDefault' => false,
224 'position' => 3,
225 ],
226 [
227 'id' => 17,
228 'label' => BackendStrings::getTemplateStrings()['venue_or_platform'],
229 'value' => 'venue_or_platform',
230 'isDefault' => false,
231 'position' => 4,
232 ],
233 [
234 'id' => 18,
235 'label' => BackendStrings::getTemplateStrings()['networking_opportunities'],
236 'value' => 'networking_opportunities',
237 'isDefault' => false,
238 'position' => 5,
239 ],
240 ]
241 ]];
242 }
243
244 /**
245 * Additional comments textarea field
246 *
247 * @return array<int, array<string, mixed>>
248 */
249 private static function getAdditionalCommentsTextareaField(): array
250 {
251 return [[
252 'id' => 20,
253 'fieldIndex' => 5,
254 'type' => 'textarea',
255 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
256 'placeholder' => BackendStrings::getTemplateStrings()['share_thoughts_about_event'],
257 'required' => false,
258 'parentId' => null,
259 'defaultValue' => '',
260 'position' => 5,
261 'labelPosition' => 'default',
262 ]];
263 }
264
265 /**
266 * Email field
267 *
268 * @return array<int, array<string, mixed>>
269 */
270 private static function getEmailField(): array
271 {
272 return [[
273 'id' => 21,
274 'fieldIndex' => 6,
275 'type' => 'email',
276 'label' => BackendStrings::getTemplateStrings()['email_address'],
277 'placeholder' => '[email protected]',
278 'required' => false,
279 'parentId' => null,
280 'defaultValue' => '',
281 'position' => 6,
282 'description' => BackendStrings::getTemplateStrings()['follow_up_email_description'],
283 ]];
284 }
285
286 /**
287 * Standard rating options (1-5)
288 *
289 * @return array<int, array<string, mixed>>
290 */
291 private static function getStandardRatingOptions(int $startId): array
292 {
293 return [
294 [
295 'id' => $startId,
296 'label' => BackendStrings::getNewFormStrings()['good'],
297 'value' => '1',
298 'isDefault' => false,
299 'position' => 1,
300 ],
301 [
302 'id' => $startId + 1,
303 'label' => BackendStrings::getNewFormStrings()['nice'],
304 'value' => '2',
305 'isDefault' => false,
306 'position' => 2,
307 ],
308 [
309 'id' => $startId + 2,
310 'label' => BackendStrings::getNewFormStrings()['very_good'],
311 'value' => '3',
312 'isDefault' => false,
313 'position' => 3,
314 ],
315 [
316 'id' => $startId + 3,
317 'label' => BackendStrings::getNewFormStrings()['awesome'],
318 'value' => '4',
319 'isDefault' => false,
320 'position' => 4,
321 ],
322 [
323 'id' => $startId + 4,
324 'label' => BackendStrings::getNewFormStrings()['amazing'],
325 'value' => '5',
326 'isDefault' => false,
327 'position' => 5,
328 ],
329 ];
330 }
331 }
332