PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / CourseContentFeedbackFormTemplate.php

CourseContentFeedbackFormTemplate.php in The Innovative Form Builder – IvyForms 1.5, at backend/src/Services/Template/CourseContentFeedbackFormTemplate.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 CourseContentFeedbackFormTemplate
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' => 'course_content_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['course_content_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['course_content_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'training-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'course-content-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()['course_content_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getCourseTopicField(),
45 self::getContentDifficultyField(),
46 self::getContentQualityRatingField(),
47 self::getContentRelevanceRatingField(),
48 self::getLearningSupportField(),
49 self::getContentSuggestionsField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Course topic dropdown
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getCourseTopicField(): array
63 {
64 return [[
65 'id' => 6,
66 'fieldIndex' => 1,
67 'type' => 'select',
68 'label' => BackendStrings::getTemplateStrings()['course_topic'],
69 'placeholder' => BackendStrings::getTemplateStrings()['select_course_topic'],
70 'required' => true,
71 'parentId' => null,
72 'defaultValue' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'id' => 1,
77 'label' => BackendStrings::getTemplateStrings()['technical_skills'],
78 'value' => 'technical_skills',
79 'isDefault' => false,
80 'position' => 1
81 ],
82 [
83 'id' => 2,
84 'label' => BackendStrings::getTemplateStrings()['soft_skills'],
85 'value' => 'soft_skills',
86 'isDefault' => false,
87 'position' => 2
88 ],
89 [
90 'id' => 3,
91 'label' => BackendStrings::getTemplateStrings()['management_leadership'],
92 'value' => 'management_leadership',
93 'isDefault' => false,
94 'position' => 3
95 ],
96 [
97 'id' => 4,
98 'label' => BackendStrings::getTemplateStrings()['compliance_safety'],
99 'value' => 'compliance_safety',
100 'isDefault' => false,
101 'position' => 4
102 ],
103 [
104 'id' => 5,
105 'label' => BackendStrings::getTemplateStrings()['other'],
106 'value' => 'other',
107 'isDefault' => false,
108 'position' => 5
109 ],
110 ]
111 ]];
112 }
113
114 /**
115 * Content difficulty radio
116 *
117 * @return array<int, array<string, mixed>>
118 */
119 private static function getContentDifficultyField(): array
120 {
121 return [[
122 'id' => 10,
123 'fieldIndex' => 2,
124 'type' => 'radio',
125 'label' => BackendStrings::getTemplateStrings()['content_difficulty_level'],
126 'required' => true,
127 'parentId' => null,
128 'defaultValue' => '',
129 'placeholder' => '',
130 'position' => 2,
131 'fieldOptions' => [
132 [
133 'id' => 7,
134 'label' => BackendStrings::getTemplateStrings()['too_basic'],
135 'value' => 'too_basic',
136 'isDefault' => false,
137 'position' => 1
138 ],
139 [
140 'id' => 8,
141 'label' => BackendStrings::getTemplateStrings()['just_right'],
142 'value' => 'just_right',
143 'isDefault' => false,
144 'position' => 2
145 ],
146 [
147 'id' => 9,
148 'label' => BackendStrings::getTemplateStrings()['too_advanced'],
149 'value' => 'too_advanced',
150 'isDefault' => false,
151 'position' => 3
152 ],
153 ]
154 ]];
155 }
156
157 /**
158 * Content quality rating
159 *
160 * @return array<int, array<string, mixed>>
161 */
162 private static function getContentQualityRatingField(): array
163 {
164 return [[
165 'id' => 11,
166 'fieldIndex' => 3,
167 'type' => 'rating',
168 'label' => BackendStrings::getTemplateStrings()['content_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' => false,
178 ]];
179 }
180
181 /**
182 * Content relevance rating
183 *
184 * @return array<int, array<string, mixed>>
185 */
186 private static function getContentRelevanceRatingField(): array
187 {
188 return [[
189 'id' => 12,
190 'fieldIndex' => 4,
191 'type' => 'rating',
192 'label' => BackendStrings::getTemplateStrings()['content_relevance'],
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 * Learning support checkbox
207 *
208 * @return array<int, array<string, mixed>>
209 */
210 private static function getLearningSupportField(): array
211 {
212 return [[
213 'id' => 18,
214 'fieldIndex' => 5,
215 'type' => 'checkbox',
216 'label' => BackendStrings::getTemplateStrings()['what_helped_your_learning'],
217 'required' => false,
218 'parentId' => null,
219 'defaultValue' => '',
220 'placeholder' => '',
221 'position' => 5,
222 'fieldOptions' => [
223 [
224 'id' => 13,
225 'label' => BackendStrings::getTemplateStrings()['clear_explanations'],
226 'value' => 'clear_explanations',
227 'isDefault' => false,
228 'position' => 1
229 ],
230 [
231 'id' => 14,
232 'label' => BackendStrings::getTemplateStrings()['real_world_examples'],
233 'value' => 'real_world_examples',
234 'isDefault' => false,
235 'position' => 2
236 ],
237 [
238 'id' => 15,
239 'label' => BackendStrings::getTemplateStrings()['exercises_assignments'],
240 'value' => 'exercises_assignments',
241 'isDefault' => false,
242 'position' => 3
243 ],
244 [
245 'id' => 16,
246 'label' => BackendStrings::getTemplateStrings()['visual_materials'],
247 'value' => 'visual_materials',
248 'isDefault' => false,
249 'position' => 4
250 ],
251 [
252 'id' => 17,
253 'label' => BackendStrings::getTemplateStrings()['case_studies'],
254 'value' => 'case_studies',
255 'isDefault' => false,
256 'position' => 5
257 ],
258 ]
259 ]];
260 }
261
262 /**
263 * Suggestions textarea
264 *
265 * @return array<int, array<string, mixed>>
266 */
267 private static function getContentSuggestionsField(): array
268 {
269 return [[
270 'id' => 19,
271 'fieldIndex' => 6,
272 'type' => 'textarea',
273 'label' => BackendStrings::getTemplateStrings()['suggestions_for_content_improvement'],
274 'placeholder' => BackendStrings::getTemplateStrings()['suggestions_for_content_improvement_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