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 / FitnessClassRegistrationFormTemplate.php

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

486 lines 17.7 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 FitnessClassRegistrationFormTemplate
13 {
14 /**
15 * Get the fitness class registration form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'fitness_class_registration_form',
23 'name' => BackendStrings::getTemplateStrings()['fitness_class_registration_form'],
24 'description' => BackendStrings::getTemplateStrings()[
25 'fitness_class_registration_form_desc'
26 ],
27 'category' => 'registration-forms',
28 'subcategory' => 'class-registration-forms',
29 'is_pro' => false,
30 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'fitness-class-registration-form.svg',
31 'form_data' => [
32 'name' => BackendStrings::getTemplateStrings()['fitness_class_registration_form'],
33 'published' => 1,
34 'showTitle' => 1,
35 'storeEntries' => 1,
36 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
37 'fields' => array_merge(
38 self::getPersonalInformationFields(),
39 self::getClassSelectionFields(),
40 self::getSchedulePreferenceFields(),
41 self::getHealthAndGoalsFields(),
42 self::getAdditionalOptionsFields()
43 ),
44 'settings' => []
45 ]
46 ];
47 }
48
49 /**
50 * Personal information fields (name, email, phone)
51 *
52 * @return array<int, array<string, mixed>>
53 */
54 private static function getPersonalInformationFields(): array
55 {
56 return [
57 // Name Field - Parent
58 [
59 'id' => 1,
60 'fieldIndex' => 1,
61 'type' => 'name',
62 'label' => BackendStrings::getTemplateStrings()['full_name'],
63 'parentId' => null,
64 'defaultValue' => '',
65 'placeholder' => '',
66 'required' => true,
67 'readonly' => false,
68 'position' => 1,
69 ],
70 // First Name - Child of Name Field
71 [
72 'id' => 2,
73 'type' => 'text',
74 'label' => BackendStrings::getTemplateStrings()['first_name'],
75 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
76 'required' => true,
77 'parentId' => 1,
78 'fieldIndex' => 1,
79 'defaultValue' => '',
80 'position' => 1,
81 'optionHide' => false,
82 'description' => '',
83 'settings' => json_encode(['nameFieldType' => 'nameField1']),
84 ],
85 // Last Name - Child of Name Field
86 [
87 'id' => 3,
88 'type' => 'text',
89 'label' => BackendStrings::getTemplateStrings()['last_name'],
90 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
91 'required' => true,
92 'parentId' => 1,
93 'fieldIndex' => 1,
94 'defaultValue' => '',
95 'position' => 2,
96 'optionHide' => false,
97 'description' => '',
98 'settings' => json_encode(['nameFieldType' => 'nameField2']),
99 ],
100 // Email Address
101 [
102 'id' => 4,
103 'fieldIndex' => 2,
104 'type' => 'email',
105 'label' => BackendStrings::getTemplateStrings()['email_address'],
106 'placeholder' => BackendStrings::getTemplateStrings()['name_placeholder'],
107 'required' => true,
108 'parentId' => null,
109 'defaultValue' => '',
110 'position' => 2,
111 ],
112 // Phone Number
113 [
114 'id' => 5,
115 'fieldIndex' => 3,
116 'type' => 'phone',
117 'label' => BackendStrings::getTemplateStrings()['phone_number'],
118 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
119 'required' => false,
120 'parentId' => null,
121 'defaultValue' => '',
122 'position' => 3,
123 'phoneAutoDetect' => true,
124 ],
125 ];
126 }
127
128 /**
129 * Class selection fields (class type, skill level)
130 *
131 * @return array<int, array<string, mixed>>
132 */
133 private static function getClassSelectionFields(): array
134 {
135 return [
136 // Class Type
137 [
138 'id' => 12,
139 'fieldIndex' => 4,
140 'type' => 'select',
141 'label' => BackendStrings::getTemplateStrings()['class_type'],
142 'placeholder' => BackendStrings::getTemplateStrings()['select_class_type'],
143 'required' => true,
144 'parentId' => null,
145 'defaultValue' => '',
146 'position' => 4,
147 'fieldOptions' => [
148 [
149 'id' => 6,
150 'label' => BackendStrings::getTemplateStrings()['yoga'],
151 'value' => 'yoga',
152 'isDefault' => false,
153 'position' => 1
154 ],
155 [
156 'id' => 7,
157 'label' => BackendStrings::getTemplateStrings()['pilates'],
158 'value' => 'pilates',
159 'isDefault' => false,
160 'position' => 2
161 ],
162 [
163 'id' => 8,
164 'label' => BackendStrings::getTemplateStrings()['hiit'],
165 'value' => 'hiit',
166 'isDefault' => false,
167 'position' => 3
168 ],
169 [
170 'id' => 9,
171 'label' => BackendStrings::getTemplateStrings()['zumba'],
172 'value' => 'zumba',
173 'isDefault' => false,
174 'position' => 4
175 ],
176 [
177 'id' => 10,
178 'label' => BackendStrings::getTemplateStrings()['crossfit'],
179 'value' => 'crossfit',
180 'isDefault' => false,
181 'position' => 5
182 ],
183 [
184 'id' => 11,
185 'label' => BackendStrings::getTemplateStrings()['other'],
186 'value' => 'other',
187 'isDefault' => false,
188 'position' => 6
189 ],
190 ]
191 ],
192 // Skill Level
193 [
194 'id' => 16,
195 'fieldIndex' => 5,
196 'type' => 'select',
197 'label' => BackendStrings::getTemplateStrings()['skill_level'],
198 'placeholder' => BackendStrings::getTemplateStrings()['select_skill_level'],
199 'required' => true,
200 'parentId' => null,
201 'defaultValue' => '',
202 'position' => 5,
203 'fieldOptions' => [
204 [
205 'id' => 13,
206 'label' => BackendStrings::getTemplateStrings()['beginner'],
207 'value' => 'beginner',
208 'isDefault' => false,
209 'position' => 1
210 ],
211 [
212 'id' => 14,
213 'label' => BackendStrings::getTemplateStrings()['intermediate'],
214 'value' => 'intermediate',
215 'isDefault' => false,
216 'position' => 2
217 ],
218 [
219 'id' => 15,
220 'label' => BackendStrings::getTemplateStrings()['advanced'],
221 'value' => 'advanced',
222 'isDefault' => false,
223 'position' => 3
224 ],
225 ]
226 ],
227 ];
228 }
229
230 /**
231 * Schedule preference fields (start date, time, duration)
232 *
233 * @return array<int, array<string, mixed>>
234 */
235 private static function getSchedulePreferenceFields(): array
236 {
237 return [
238 // Preferred Start Date
239 [
240 'id' => 17,
241 'fieldIndex' => 6,
242 'type' => 'date',
243 'label' => BackendStrings::getTemplateStrings()['preferred_start_date'],
244 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_start_date'],
245 'required' => true,
246 'parentId' => null,
247 'defaultValue' => '',
248 'position' => 6,
249 'dateFieldType' => 'picker',
250 'dateFormat' => 'MM/DD/YYYY',
251 ],
252 // Preferred Class Time
253 [
254 'id' => 21,
255 'fieldIndex' => 9,
256 'type' => 'select',
257 'label' => BackendStrings::getTemplateStrings()['preferred_class_time'],
258 'placeholder' => BackendStrings::getTemplateStrings()['select_preferred_class_time'],
259 'required' => false,
260 'parentId' => null,
261 'defaultValue' => '',
262 'position' => 9,
263 'fieldOptions' => [
264 [
265 'id' => 18,
266 'label' => BackendStrings::getTemplateStrings()['morning'],
267 'value' => 'morning',
268 'isDefault' => false,
269 'position' => 1
270 ],
271 [
272 'id' => 19,
273 'label' => BackendStrings::getTemplateStrings()['afternoon'],
274 'value' => 'afternoon',
275 'isDefault' => false,
276 'position' => 2
277 ],
278 [
279 'id' => 20,
280 'label' => BackendStrings::getTemplateStrings()['evening'],
281 'value' => 'evening',
282 'isDefault' => false,
283 'position' => 3
284 ],
285 ]
286 ],
287 // Preferred Class Duration
288 [
289 'id' => 26,
290 'fieldIndex' => 11,
291 'type' => 'select',
292 'label' => BackendStrings::getTemplateStrings()['preferred_class_duration'],
293 'placeholder' => BackendStrings::getTemplateStrings()[
294 'select_preferred_class_duration'
295 ],
296 'required' => false,
297 'parentId' => null,
298 'defaultValue' => '',
299 'position' => 11,
300 'fieldOptions' => [
301 [
302 'id' => 22,
303 'label' => BackendStrings::getTemplateStrings()['duration_30_min'],
304 'value' => '30_min',
305 'isDefault' => false,
306 'position' => 1
307 ],
308 [
309 'id' => 23,
310 'label' => BackendStrings::getTemplateStrings()['duration_1_hour'],
311 'value' => '1_hour',
312 'isDefault' => false,
313 'position' => 2
314 ],
315 [
316 'id' => 24,
317 'label' => BackendStrings::getTemplateStrings()['duration_90_min'],
318 'value' => '90_min',
319 'isDefault' => false,
320 'position' => 3
321 ],
322 [
323 'id' => 25,
324 'label' => BackendStrings::getTemplateStrings()['duration_2_hours'],
325 'value' => '2_hours',
326 'isDefault' => false,
327 'position' => 4
328 ],
329 ]
330 ],
331 ];
332 }
333
334 /**
335 * Health and goals fields (health notes, equipment, fitness goals)
336 *
337 * @return array<int, array<string, mixed>>
338 */
339 private static function getHealthAndGoalsFields(): array
340 {
341 return [
342 // Health Notes / Injuries
343 [
344 'id' => 27,
345 'fieldIndex' => 7,
346 'type' => 'textarea',
347 'label' => BackendStrings::getTemplateStrings()['health_notes_injuries'],
348 'placeholder' => BackendStrings::getTemplateStrings()[
349 'describe_health_conditions_injuries'
350 ],
351 'parentId' => null,
352 'defaultValue' => '',
353 'position' => 7,
354 'required' => false,
355 'rows' => 3,
356 ],
357 // Require Equipment? (radio)
358 [
359 'id' => 30,
360 'fieldIndex' => 8,
361 'type' => 'radio',
362 'label' => BackendStrings::getTemplateStrings()['require_equipment'],
363 'parentId' => null,
364 'position' => 8,
365 'required' => false,
366 'defaultValue' => '',
367 'placeholder' => '',
368 'fieldOptions' => [
369 [
370 'id' => 28,
371 'label' => BackendStrings::getTemplateStrings()['yes'],
372 'value' => 'yes',
373 'isDefault' => false,
374 'position' => 1
375 ],
376 [
377 'id' => 29,
378 'label' => BackendStrings::getTemplateStrings()['no'],
379 'value' => 'no',
380 'isDefault' => false,
381 'position' => 2
382 ],
383 ],
384 ],
385 // Fitness Goals
386 [
387 'id' => 31,
388 'fieldIndex' => 10,
389 'type' => 'textarea',
390 'label' => BackendStrings::getTemplateStrings()['fitness_goals'],
391 'placeholder' => BackendStrings::getTemplateStrings()[
392 'fitness_goals_placeholder'
393 ],
394 'parentId' => null,
395 'defaultValue' => '',
396 'position' => 10,
397 'required' => false,
398 'rows' => 3,
399 ],
400 ];
401 }
402
403 /**
404 * Additional options fields (personal training interest, trainer preference, updates)
405 *
406 * @return array<int, array<string, mixed>>
407 */
408 private static function getAdditionalOptionsFields(): array
409 {
410 return [
411 // Interested in Personal Training? (radio)
412 [
413 'id' => 34,
414 'fieldIndex' => 12,
415 'type' => 'radio',
416 'label' => BackendStrings::getTemplateStrings()[
417 'interested_personal_training'
418 ],
419 'parentId' => null,
420 'position' => 12,
421 'required' => false,
422 'defaultValue' => '',
423 'placeholder' => '',
424 'fieldOptions' => [
425 [
426 'id' => 32,
427 'label' => BackendStrings::getTemplateStrings()['yes'],
428 'value' => 'yes',
429 'isDefault' => false,
430 'position' => 1
431 ],
432 [
433 'id' => 33,
434 'label' => BackendStrings::getTemplateStrings()['no'],
435 'value' => 'no',
436 'isDefault' => false,
437 'position' => 2
438 ],
439 ],
440 ],
441 // Trainer Preference
442 [
443 'id' => 35,
444 'fieldIndex' => 13,
445 'type' => 'text',
446 'label' => BackendStrings::getTemplateStrings()['trainer_preference'],
447 'placeholder' => BackendStrings::getTemplateStrings()[
448 'enter_trainer_name_if_any'
449 ],
450 'required' => false,
451 'parentId' => null,
452 'defaultValue' => '',
453 'position' => 13,
454 ],
455 // Receive updates about future classes? (radio)
456 [
457 'id' => 38,
458 'fieldIndex' => 14,
459 'type' => 'radio',
460 'label' => BackendStrings::getTemplateStrings()['receive_updates_future_classes'],
461 'parentId' => null,
462 'position' => 14,
463 'required' => false,
464 'defaultValue' => '',
465 'placeholder' => '',
466 'fieldOptions' => [
467 [
468 'id' => 36,
469 'label' => BackendStrings::getTemplateStrings()['yes'],
470 'value' => 'yes',
471 'isDefault' => false,
472 'position' => 1
473 ],
474 [
475 'id' => 37,
476 'label' => BackendStrings::getTemplateStrings()['no'],
477 'value' => 'no',
478 'isDefault' => false,
479 'position' => 2
480 ],
481 ],
482 ],
483 ];
484 }
485 }
486