| 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 CourseContentFeedbackFormTemplate |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Get the Course Content Feedback Form template |
| 16 |
* |
| 17 |
* @return array<string, mixed> |
| 18 |
*/ |
| 19 |
public static function getTemplate(): array |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'id' => 'course_content_feedback_form', |
| 23 |
'name' => BackendStrings::getTemplateStrings()['course_content_feedback_form'], |
| 24 |
'description' => BackendStrings::getTemplateStrings()['course_content_feedback_form_desc'], |
| 25 |
'category' => 'feedback-forms', |
| 26 |
'subcategory' => 'training-feedback-forms', |
| 27 |
'is_pro' => false, |
| 28 |
'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'course-content-feedback-form.svg', |
| 29 |
'form_data' => [ |
| 30 |
'name' => BackendStrings::getTemplateStrings()['course_content_feedback_form'], |
| 31 |
'published' => 1, |
| 32 |
'showTitle' => 1, |
| 33 |
'storeEntries' => 1, |
| 34 |
'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 35 |
'fields' => array_merge( |
| 36 |
self::getCourseTopicField(), |
| 37 |
self::getContentDifficultyField(), |
| 38 |
self::getContentQualityRatingField(), |
| 39 |
self::getContentRelevanceRatingField(), |
| 40 |
self::getLearningSupportField(), |
| 41 |
self::getContentSuggestionsField() |
| 42 |
), |
| 43 |
'settings' => [] |
| 44 |
] |
| 45 |
]; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Course topic dropdown |
| 50 |
* |
| 51 |
* @return array<int, array<string, mixed>> |
| 52 |
*/ |
| 53 |
private static function getCourseTopicField(): array |
| 54 |
{ |
| 55 |
return [[ |
| 56 |
'id' => 6, |
| 57 |
'fieldIndex' => 1, |
| 58 |
'type' => 'select', |
| 59 |
'label' => BackendStrings::getTemplateStrings()['course_topic'], |
| 60 |
'placeholder' => BackendStrings::getTemplateStrings()['select_course_topic'], |
| 61 |
'required' => true, |
| 62 |
'parentId' => null, |
| 63 |
'defaultValue' => '', |
| 64 |
'position' => 1, |
| 65 |
'fieldOptions' => [ |
| 66 |
[ |
| 67 |
'id' => 1, |
| 68 |
'label' => BackendStrings::getTemplateStrings()['technical_skills'], |
| 69 |
'value' => 'technical_skills', |
| 70 |
'isDefault' => false, |
| 71 |
'position' => 1 |
| 72 |
], |
| 73 |
[ |
| 74 |
'id' => 2, |
| 75 |
'label' => BackendStrings::getTemplateStrings()['soft_skills'], |
| 76 |
'value' => 'soft_skills', |
| 77 |
'isDefault' => false, |
| 78 |
'position' => 2 |
| 79 |
], |
| 80 |
[ |
| 81 |
'id' => 3, |
| 82 |
'label' => BackendStrings::getTemplateStrings()['management_leadership'], |
| 83 |
'value' => 'management_leadership', |
| 84 |
'isDefault' => false, |
| 85 |
'position' => 3 |
| 86 |
], |
| 87 |
[ |
| 88 |
'id' => 4, |
| 89 |
'label' => BackendStrings::getTemplateStrings()['compliance_safety'], |
| 90 |
'value' => 'compliance_safety', |
| 91 |
'isDefault' => false, |
| 92 |
'position' => 4 |
| 93 |
], |
| 94 |
[ |
| 95 |
'id' => 5, |
| 96 |
'label' => BackendStrings::getTemplateStrings()['other'], |
| 97 |
'value' => 'other', |
| 98 |
'isDefault' => false, |
| 99 |
'position' => 5 |
| 100 |
], |
| 101 |
] |
| 102 |
]]; |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Content difficulty radio |
| 107 |
* |
| 108 |
* @return array<int, array<string, mixed>> |
| 109 |
*/ |
| 110 |
private static function getContentDifficultyField(): array |
| 111 |
{ |
| 112 |
return [[ |
| 113 |
'id' => 10, |
| 114 |
'fieldIndex' => 2, |
| 115 |
'type' => 'radio', |
| 116 |
'label' => BackendStrings::getTemplateStrings()['content_difficulty_level'], |
| 117 |
'required' => true, |
| 118 |
'parentId' => null, |
| 119 |
'defaultValue' => '', |
| 120 |
'placeholder' => '', |
| 121 |
'position' => 2, |
| 122 |
'fieldOptions' => [ |
| 123 |
[ |
| 124 |
'id' => 7, |
| 125 |
'label' => BackendStrings::getTemplateStrings()['too_basic'], |
| 126 |
'value' => 'too_basic', |
| 127 |
'isDefault' => false, |
| 128 |
'position' => 1 |
| 129 |
], |
| 130 |
[ |
| 131 |
'id' => 8, |
| 132 |
'label' => BackendStrings::getTemplateStrings()['just_right'], |
| 133 |
'value' => 'just_right', |
| 134 |
'isDefault' => false, |
| 135 |
'position' => 2 |
| 136 |
], |
| 137 |
[ |
| 138 |
'id' => 9, |
| 139 |
'label' => BackendStrings::getTemplateStrings()['too_advanced'], |
| 140 |
'value' => 'too_advanced', |
| 141 |
'isDefault' => false, |
| 142 |
'position' => 3 |
| 143 |
], |
| 144 |
] |
| 145 |
]]; |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* Content quality rating |
| 150 |
* |
| 151 |
* @return array<int, array<string, mixed>> |
| 152 |
*/ |
| 153 |
private static function getContentQualityRatingField(): array |
| 154 |
{ |
| 155 |
return [[ |
| 156 |
'id' => 11, |
| 157 |
'fieldIndex' => 3, |
| 158 |
'type' => 'rating', |
| 159 |
'label' => BackendStrings::getTemplateStrings()['content_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' => false, |
| 169 |
]]; |
| 170 |
} |
| 171 |
|
| 172 |
/** |
| 173 |
* Content relevance rating |
| 174 |
* |
| 175 |
* @return array<int, array<string, mixed>> |
| 176 |
*/ |
| 177 |
private static function getContentRelevanceRatingField(): array |
| 178 |
{ |
| 179 |
return [[ |
| 180 |
'id' => 12, |
| 181 |
'fieldIndex' => 4, |
| 182 |
'type' => 'rating', |
| 183 |
'label' => BackendStrings::getTemplateStrings()['content_relevance'], |
| 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' => false, |
| 193 |
]]; |
| 194 |
} |
| 195 |
|
| 196 |
/** |
| 197 |
* Learning support checkbox |
| 198 |
* |
| 199 |
* @return array<int, array<string, mixed>> |
| 200 |
*/ |
| 201 |
private static function getLearningSupportField(): array |
| 202 |
{ |
| 203 |
return [[ |
| 204 |
'id' => 18, |
| 205 |
'fieldIndex' => 5, |
| 206 |
'type' => 'checkbox', |
| 207 |
'label' => BackendStrings::getTemplateStrings()['what_helped_your_learning'], |
| 208 |
'required' => false, |
| 209 |
'parentId' => null, |
| 210 |
'defaultValue' => '', |
| 211 |
'placeholder' => '', |
| 212 |
'position' => 5, |
| 213 |
'fieldOptions' => [ |
| 214 |
[ |
| 215 |
'id' => 13, |
| 216 |
'label' => BackendStrings::getTemplateStrings()['clear_explanations'], |
| 217 |
'value' => 'clear_explanations', |
| 218 |
'isDefault' => false, |
| 219 |
'position' => 1 |
| 220 |
], |
| 221 |
[ |
| 222 |
'id' => 14, |
| 223 |
'label' => BackendStrings::getTemplateStrings()['real_world_examples'], |
| 224 |
'value' => 'real_world_examples', |
| 225 |
'isDefault' => false, |
| 226 |
'position' => 2 |
| 227 |
], |
| 228 |
[ |
| 229 |
'id' => 15, |
| 230 |
'label' => BackendStrings::getTemplateStrings()['exercises_assignments'], |
| 231 |
'value' => 'exercises_assignments', |
| 232 |
'isDefault' => false, |
| 233 |
'position' => 3 |
| 234 |
], |
| 235 |
[ |
| 236 |
'id' => 16, |
| 237 |
'label' => BackendStrings::getTemplateStrings()['visual_materials'], |
| 238 |
'value' => 'visual_materials', |
| 239 |
'isDefault' => false, |
| 240 |
'position' => 4 |
| 241 |
], |
| 242 |
[ |
| 243 |
'id' => 17, |
| 244 |
'label' => BackendStrings::getTemplateStrings()['case_studies'], |
| 245 |
'value' => 'case_studies', |
| 246 |
'isDefault' => false, |
| 247 |
'position' => 5 |
| 248 |
], |
| 249 |
] |
| 250 |
]]; |
| 251 |
} |
| 252 |
|
| 253 |
/** |
| 254 |
* Suggestions textarea |
| 255 |
* |
| 256 |
* @return array<int, array<string, mixed>> |
| 257 |
*/ |
| 258 |
private static function getContentSuggestionsField(): array |
| 259 |
{ |
| 260 |
return [[ |
| 261 |
'id' => 19, |
| 262 |
'fieldIndex' => 6, |
| 263 |
'type' => 'textarea', |
| 264 |
'label' => BackendStrings::getTemplateStrings()['suggestions_for_content_improvement'], |
| 265 |
'placeholder' => BackendStrings::getTemplateStrings()['suggestions_for_content_improvement_placeholder'], |
| 266 |
'required' => false, |
| 267 |
'parentId' => null, |
| 268 |
'defaultValue' => '', |
| 269 |
'position' => 6, |
| 270 |
'rows' => 3, |
| 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 |
|