PluginProbe
The Innovative Form Builder – IvyForms / 1.4
The Innovative Form Builder – IvyForms v1.4
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 1.4, at backend/src/Services/Template/EventFeedbackFormTemplate.php

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