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

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

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