PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / TrainerFeedbackFormTemplate.php

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

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