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

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

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