PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
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 / NetworkingEventFeedbackFormTemplate.php

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

308 lines 10.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 NetworkingEventFeedbackFormTemplate
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' => 'networking_event_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['networking_event_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['networking_event_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'event-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'networking-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()['networking_event_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getConnectionsRadioField(),
45 self::getNetworkingValueRatingField(),
46 self::getWhatHelpedCheckboxField(),
47 self::getImprovementTextareaField(),
48 self::getNameField()
49 ),
50 'settings' => []
51 ]
52 ]
53 );
54 }
55
56 /**
57 * Radio: Did you make valuable connections?
58 *
59 * @return array<int, array<string, mixed>>
60 */
61 private static function getConnectionsRadioField(): array
62 {
63 return [[
64 'id' => 5,
65 'fieldIndex' => 1,
66 'type' => 'radio',
67 'label' => BackendStrings::getTemplateStrings()['did_make_valuable_connections'],
68 'required' => true,
69 'parentId' => null,
70 'defaultValue' => '',
71 'placeholder' => '',
72 'position' => 1,
73 'fieldOptions' => [
74 [
75 'id' => 1,
76 'label' => BackendStrings::getTemplateStrings()['yes_many'],
77 'value' => 'yes_many',
78 'isDefault' => false,
79 'position' => 1
80 ],
81 [
82 'id' => 2,
83 'label' => BackendStrings::getTemplateStrings()['yes_a_few'],
84 'value' => 'yes_few',
85 'isDefault' => false,
86 'position' => 2
87 ],
88 [
89 'id' => 3,
90 'label' => BackendStrings::getTemplateStrings()['not_really'],
91 'value' => 'not_really',
92 'isDefault' => false,
93 'position' => 3
94 ],
95 [
96 'id' => 4,
97 'label' => BackendStrings::getTemplateStrings()['no_connections'],
98 'value' => 'no',
99 'isDefault' => false,
100 'position' => 4
101 ],
102 ]
103 ]];
104 }
105
106 /**
107 * Rating: Networking value
108 *
109 * @return array<int, array<string, mixed>>
110 */
111 private static function getNetworkingValueRatingField(): array
112 {
113 return [[
114 'id' => 6,
115 'fieldIndex' => 2,
116 'type' => 'rating',
117 'label' => BackendStrings::getTemplateStrings()['networking_value'],
118 'required' => true,
119 'defaultValue' => '',
120 'placeholder' => '',
121 'position' => 2,
122 'labelPosition' => 'default',
123 'ratingIcon' => 'star',
124 'fieldOptions' => self::getStandardRatingOptions(5),
125 'showValues' => false,
126 'showRatingText' => true,
127 ]];
128 }
129
130 /**
131 * Checkbox: What helped with networking?
132 *
133 * @return array<int, array<string, mixed>>
134 */
135 private static function getWhatHelpedCheckboxField(): array
136 {
137 return [[
138 'id' => 12,
139 'fieldIndex' => 3,
140 'type' => 'checkbox',
141 'label' => BackendStrings::getTemplateStrings()['what_helped_with_networking'],
142 'required' => false,
143 'parentId' => null,
144 'defaultValue' => '',
145 'placeholder' => '',
146 'position' => 3,
147 'fieldOptions' => [
148 [
149 'id' => 7,
150 'label' => BackendStrings::getTemplateStrings()['event_format'],
151 'value' => 'event_format',
152 'isDefault' => false,
153 'position' => 1
154 ],
155 [
156 'id' => 8,
157 'label' => BackendStrings::getTemplateStrings()['attendee_quality'],
158 'value' => 'attendee_quality',
159 'isDefault' => false,
160 'position' => 2
161 ],
162 [
163 'id' => 9,
164 'label' => BackendStrings::getTemplateStrings()['structured_activities'],
165 'value' => 'structured_activities',
166 'isDefault' => false,
167 'position' => 3
168 ],
169 [
170 'id' => 10,
171 'label' => BackendStrings::getTemplateStrings()['open_networking_time'],
172 'value' => 'open_networking_time',
173 'isDefault' => false,
174 'position' => 4
175 ],
176 [
177 'id' => 11,
178 'label' => BackendStrings::getTemplateStrings()['venue_or_atmosphere'],
179 'value' => 'venue_atmosphere',
180 'isDefault' => false,
181 'position' => 5
182 ],
183 ]
184 ]];
185 }
186
187 /**
188 * Paragraph: How could networking be improved?
189 *
190 * @return array<int, array<string, mixed>>
191 */
192 private static function getImprovementTextareaField(): array
193 {
194 return [[
195 'id' => 13,
196 'fieldIndex' => 4,
197 'type' => 'textarea',
198 'label' => BackendStrings::getTemplateStrings()['how_could_networking_be_improved'],
199 'placeholder' => BackendStrings::getTemplateStrings()['share_suggestions_to_improve_networking'],
200 'required' => false,
201 'parentId' => null,
202 'defaultValue' => '',
203 'position' => 4,
204 'labelPosition' => 'default',
205 ]];
206 }
207
208 /**
209 * Name field (optional)
210 *
211 * @return array<int, array<string, mixed>>
212 */
213 private static function getNameField(): array
214 {
215 return [
216 // Parent Name field
217 [
218 'id' => 14,
219 'fieldIndex' => 5,
220 'type' => 'name',
221 'label' => BackendStrings::getTemplateStrings()['full_name'],
222 'parentId' => null,
223 'defaultValue' => '',
224 'placeholder' => '',
225 'required' => false,
226 'readonly' => false,
227 'position' => 5,
228 ],
229 // First name - child
230 [
231 'id' => 15,
232 'type' => 'text',
233 'label' => BackendStrings::getNewFormStrings()['first_name'],
234 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
235 'required' => false,
236 'parentId' => 5,
237 'fieldIndex' => 5,
238 'defaultValue' => '',
239 'position' => 1,
240 'optionHide' => false,
241 'description' => '',
242 'settings' => json_encode(['nameFieldType' => 'nameField1']),
243 ],
244 // Last name - child
245 [
246 'id' => 16,
247 'type' => 'text',
248 'label' => BackendStrings::getNewFormStrings()['last_name'],
249 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
250 'required' => false,
251 'parentId' => 5,
252 'fieldIndex' => 5,
253 'defaultValue' => '',
254 'position' => 2,
255 'optionHide' => false,
256 'description' => '',
257 'settings' => json_encode(['nameFieldType' => 'nameField2']),
258 ],
259 ];
260 }
261
262 /**
263 * Standard rating options (1-5)
264 *
265 * @return array<int, array<string, mixed>>
266 */
267 private static function getStandardRatingOptions(int $startId): array
268 {
269 return [
270 [
271 'id' => $startId,
272 'label' => BackendStrings::getNewFormStrings()['good'],
273 'value' => '1',
274 'isDefault' => false,
275 'position' => 1
276 ],
277 [
278 'id' => $startId + 1,
279 'label' => BackendStrings::getNewFormStrings()['nice'],
280 'value' => '2',
281 'isDefault' => false,
282 'position' => 2
283 ],
284 [
285 'id' => $startId + 2,
286 'label' => BackendStrings::getNewFormStrings()['very_good'],
287 'value' => '3',
288 'isDefault' => false,
289 'position' => 3
290 ],
291 [
292 'id' => $startId + 3,
293 'label' => BackendStrings::getNewFormStrings()['awesome'],
294 'value' => '4',
295 'isDefault' => false,
296 'position' => 4
297 ],
298 [
299 'id' => $startId + 4,
300 'label' => BackendStrings::getNewFormStrings()['amazing'],
301 'value' => '5',
302 'isDefault' => false,
303 'position' => 5
304 ],
305 ];
306 }
307 }
308