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

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

321 lines 10.6 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 TrainingEventFeedbackFormTemplate
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' => 'training_event_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['training_event_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['training_event_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'event-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'training-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()['training_event_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getTrainingTopicDropdownField(),
45 self::getTrainingQualityRadioField(),
46 self::getInstructorQualityRatingFields(),
47 self::getSkillsGainedCheckboxField(),
48 self::getAdditionalCommentsTextareaField()
49 ),
50 'settings' => []
51 ]
52 ]
53 );
54 }
55
56 /**
57 * Training topic dropdown field
58 *
59 * @return array<int, array<string, mixed>>
60 */
61 private static function getTrainingTopicDropdownField(): array
62 {
63 return [[
64 'id' => 6,
65 'fieldIndex' => 1,
66 'type' => 'select',
67 'label' => BackendStrings::getTemplateStrings()['training_topic'],
68 'placeholder' => BackendStrings::getTemplateStrings()['select_training_topic'],
69 'required' => true,
70 'parentId' => null,
71 'defaultValue' => '',
72 'position' => 1,
73 'fieldOptions' => [
74 [
75 'id' => 1,
76 'label' => BackendStrings::getTemplateStrings()['technical_skills'],
77 'value' => 'technical_skills',
78 'isDefault' => false,
79 'position' => 1
80 ],
81 [
82 'id' => 2,
83 'label' => BackendStrings::getTemplateStrings()['soft_skills'],
84 'value' => 'soft_skills',
85 'isDefault' => false,
86 'position' => 2
87 ],
88 [
89 'id' => 3,
90 'label' => BackendStrings::getTemplateStrings()['leadership'],
91 'value' => 'leadership',
92 'isDefault' => false,
93 'position' => 3
94 ],
95 [
96 'id' => 4,
97 'label' => BackendStrings::getTemplateStrings()['compliance'],
98 'value' => 'compliance',
99 'isDefault' => false,
100 'position' => 4
101 ],
102 [
103 'id' => 5,
104 'label' => BackendStrings::getTemplateStrings()['other'],
105 'value' => 'other',
106 'isDefault' => false,
107 'position' => 5
108 ],
109 ]
110 ]];
111 }
112
113 /**
114 * Training quality radio field
115 *
116 * @return array<int, array<string, mixed>>
117 */
118 private static function getTrainingQualityRadioField(): array
119 {
120 return [[
121 'id' => 10,
122 'fieldIndex' => 2,
123 'type' => 'radio',
124 'label' => BackendStrings::getTemplateStrings()['training_level'],
125 'required' => true,
126 'parentId' => null,
127 'defaultValue' => '',
128 'placeholder' => '',
129 'position' => 2,
130 'fieldOptions' => [
131 [
132 'id' => 7,
133 'label' => BackendStrings::getTemplateStrings()['too_basic'],
134 'value' => 'too_basic',
135 'isDefault' => false,
136 'position' => 1
137 ],
138 [
139 'id' => 8,
140 'label' => BackendStrings::getTemplateStrings()['just_right'],
141 'value' => 'just_right',
142 'isDefault' => false,
143 'position' => 2
144 ],
145 [
146 'id' => 9,
147 'label' => BackendStrings::getTemplateStrings()['too_advanced'],
148 'value' => 'too_advanced',
149 'isDefault' => false,
150 'position' => 3
151 ],
152 ]
153 ]];
154 }
155
156 /**
157 * Instructor quality rating field
158 *
159 * @return array<int, array<string, mixed>>
160 */
161 private static function getInstructorQualityRatingFields(): array
162 {
163 return [
164 [
165 'id' => 11,
166 'fieldIndex' => 3,
167 'type' => 'rating',
168 'label' => BackendStrings::getTemplateStrings()['training_quality'],
169 'required' => true,
170 'defaultValue' => '',
171 'placeholder' => '',
172 'position' => 3,
173 'labelPosition' => 'default',
174 'ratingIcon' => 'star',
175 'fieldOptions' => self::getStandardRatingOptions(9),
176 'showValues' => false,
177 'showRatingText' => true,
178 ],
179 [
180 'id' => 12,
181 'fieldIndex' => 4,
182 'type' => 'rating',
183 'label' => BackendStrings::getTemplateStrings()['training_knowledge'],
184 'required' => true,
185 'defaultValue' => '',
186 'placeholder' => '',
187 'position' => 4,
188 'labelPosition' => 'default',
189 'ratingIcon' => 'star',
190 'fieldOptions' => self::getStandardRatingOptions(14),
191 'showValues' => false,
192 'showRatingText' => true,
193 ]
194 ];
195 }
196
197 /**
198 * Skills gained checkbox field
199 *
200 * @return array<int, array<string, mixed>>
201 */
202 private static function getSkillsGainedCheckboxField(): array
203 {
204 return [[
205 'id' => 18,
206 'fieldIndex' => 5,
207 'type' => 'checkbox',
208 'label' => BackendStrings::getTemplateStrings()['training_gained_skills'],
209 'required' => false,
210 'parentId' => null,
211 'defaultValue' => '',
212 'placeholder' => '',
213 'position' => 5,
214 'fieldOptions' => [
215 [
216 'id' => 13,
217 'label' => BackendStrings::getTemplateStrings()['new_skills'],
218 'value' => 'new_skills',
219 'isDefault' => false,
220 'position' => 1
221 ],
222 [
223 'id' => 14,
224 'label' => BackendStrings::getTemplateStrings()['practical_knowledge'],
225 'value' => 'practical_knowledge',
226 'isDefault' => false,
227 'position' => 2
228 ],
229 [
230 'id' => 15,
231 'label' => BackendStrings::getTemplateStrings()['certification_or_credits'],
232 'value' => 'certification_or_credits',
233 'isDefault' => false,
234 'position' => 3
235 ],
236 [
237 'id' => 16,
238 'label' => BackendStrings::getTemplateStrings()['better_undestranding'],
239 'value' => 'better_undestranding',
240 'isDefault' => false,
241 'position' => 4
242 ],
243 [
244 'id' => 17,
245 'label' => BackendStrings::getTemplateStrings()['networking_opportunities'],
246 'value' => 'networking_opportunities',
247 'isDefault' => false,
248 'position' => 5
249 ],
250 ]
251 ]];
252 }
253
254 /**
255 * Additional comments textarea field
256 *
257 * @return array<int, array<string, mixed>>
258 */
259 private static function getAdditionalCommentsTextareaField(): array
260 {
261 return [[
262 'id' => 19,
263 'fieldIndex' => 5,
264 'type' => 'textarea',
265 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
266 'placeholder' => BackendStrings::getTemplateStrings()['additional_comments_placeholder'],
267 'required' => false,
268 'parentId' => null,
269 'defaultValue' => '',
270 'position' => 5,
271 'labelPosition' => 'default',
272 ]];
273 }
274
275 /**
276 * Standard rating options
277 *
278 * @return array<int, array<string, mixed>>
279 */
280 private static function getStandardRatingOptions(int $startId): array
281 {
282 return [
283 [
284 'id' => $startId,
285 'label' => BackendStrings::getNewFormStrings()['good'],
286 'value' => '1',
287 'isDefault' => false,
288 'position' => 1
289 ],
290 [
291 'id' => $startId + 1,
292 'label' => BackendStrings::getNewFormStrings()['nice'],
293 'value' => '2',
294 'isDefault' => false,
295 'position' => 2
296 ],
297 [
298 'id' => $startId + 2,
299 'label' => BackendStrings::getNewFormStrings()['very_good'],
300 'value' => '3',
301 'isDefault' => false,
302 'position' => 3
303 ],
304 [
305 'id' => $startId + 3,
306 'label' => BackendStrings::getNewFormStrings()['awesome'],
307 'value' => '4',
308 'isDefault' => false,
309 'position' => 4
310 ],
311 [
312 'id' => $startId + 4,
313 'label' => BackendStrings::getNewFormStrings()['amazing'],
314 'value' => '5',
315 'isDefault' => false,
316 'position' => 5
317 ],
318 ];
319 }
320 }
321