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

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

343 lines 11.1 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 ServiceSpecificClientFeedbackFormTemplate
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' => 'service_specific_client_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['service_specific_client_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['service_specific_client_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'client-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'service-specific-client-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()['service_specific_client_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getServiceReceivedDropdownField(),
45 self::getServiceMeetNeedsRadioField(),
46 self::getServiceQualityRatingField(),
47 self::getValueForMoneyRatingField(),
48 self::getServiceStrengthsCheckboxField(),
49 self::getAdditionalCommentsParagraphField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Service received dropdown field
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getServiceReceivedDropdownField(): array
63 {
64 return [[
65 'id' => 7,
66 'fieldIndex' => 1,
67 'type' => 'select',
68 'label' => BackendStrings::getTemplateStrings()['service_received'],
69 'placeholder' => BackendStrings::getTemplateStrings()['select_service'],
70 'required' => true,
71 'parentId' => null,
72 'defaultValue' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'id' => 1,
77 'label' => BackendStrings::getTemplateStrings()['consulting'],
78 'value' => 'consulting',
79 'isDefault' => false,
80 'position' => 1
81 ],
82 [
83 'id' => 2,
84 'label' => BackendStrings::getTemplateStrings()['design'],
85 'value' => 'design',
86 'isDefault' => false,
87 'position' => 2
88 ],
89 [
90 'id' => 3,
91 'label' => BackendStrings::getTemplateStrings()['development'],
92 'value' => 'development',
93 'isDefault' => false,
94 'position' => 3
95 ],
96 [
97 'id' => 4,
98 'label' => BackendStrings::getTemplateStrings()['marketing'],
99 'value' => 'marketing',
100 'isDefault' => false,
101 'position' => 4
102 ],
103 [
104 'id' => 5,
105 'label' => BackendStrings::getTemplateStrings()['support'],
106 'value' => 'support',
107 'isDefault' => false,
108 'position' => 5
109 ],
110 [
111 'id' => 6,
112 'label' => BackendStrings::getTemplateStrings()['other'],
113 'value' => 'other',
114 'isDefault' => false,
115 'position' => 6
116 ],
117 ]
118 ]];
119 }
120
121 /**
122 * Service meet needs radio field
123 *
124 * @return array<int, array<string, mixed>>
125 */
126 private static function getServiceMeetNeedsRadioField(): array
127 {
128 return [[
129 'id' => 12,
130 'fieldIndex' => 2,
131 'type' => 'radio',
132 'label' => BackendStrings::getTemplateStrings()['did_service_meet_needs'],
133 'required' => true,
134 'parentId' => null,
135 'defaultValue' => '',
136 'placeholder' => '',
137 'position' => 2,
138 'fieldOptions' => [
139 [
140 'id' => 8,
141 'label' => BackendStrings::getTemplateStrings()['fully'],
142 'value' => 'fully',
143 'isDefault' => false,
144 'position' => 1
145 ],
146 [
147 'id' => 9,
148 'label' => BackendStrings::getTemplateStrings()['mostly'],
149 'value' => 'mostly',
150 'isDefault' => false,
151 'position' => 2
152 ],
153 [
154 'id' => 10,
155 'label' => BackendStrings::getTemplateStrings()['partially'],
156 'value' => 'partially',
157 'isDefault' => false,
158 'position' => 3
159 ],
160 [
161 'id' => 11,
162 'label' => BackendStrings::getTemplateStrings()['not_at_all'],
163 'value' => 'not_at_all',
164 'isDefault' => false,
165 'position' => 4
166 ],
167 ]
168 ]];
169 }
170
171 /**
172 * Service quality rating field
173 *
174 * @return array<int, array<string, mixed>>
175 */
176 private static function getServiceQualityRatingField(): array
177 {
178 return [[
179 'id' => 13,
180 'fieldIndex' => 3,
181 'type' => 'rating',
182 'label' => BackendStrings::getTemplateStrings()['service_quality'],
183 'required' => true,
184 'defaultValue' => '',
185 'placeholder' => '',
186 'position' => 3,
187 'labelPosition' => 'default',
188 'ratingIcon' => 'star',
189 'fieldOptions' => self::getStandardRatingOptions(11),
190 'showValues' => false,
191 'showRatingText' => true,
192 ]];
193 }
194
195 /**
196 * Value for money rating field
197 *
198 * @return array<int, array<string, mixed>>
199 */
200 private static function getValueForMoneyRatingField(): array
201 {
202 return [[
203 'id' => 14,
204 'fieldIndex' => 4,
205 'type' => 'rating',
206 'label' => BackendStrings::getTemplateStrings()['value_for_money'],
207 'required' => true,
208 'defaultValue' => '',
209 'placeholder' => '',
210 'position' => 4,
211 'labelPosition' => 'default',
212 'ratingIcon' => 'star',
213 'fieldOptions' => self::getStandardRatingOptions(16),
214 'showValues' => false,
215 'showRatingText' => true,
216 ]];
217 }
218
219 /**
220 * Service strengths checkbox field
221 *
222 * @return array<int, array<string, mixed>>
223 */
224 private static function getServiceStrengthsCheckboxField(): array
225 {
226 return [[
227 'id' => 20,
228 'fieldIndex' => 5,
229 'type' => 'checkbox',
230 'label' => BackendStrings::getTemplateStrings()['strengths_of_service'],
231 'required' => false,
232 'parentId' => null,
233 'defaultValue' => '',
234 'placeholder' => '',
235 'position' => 5,
236 'fieldOptions' => [
237 [
238 'id' => 15,
239 'label' => BackendStrings::getTemplateStrings()['expertise'],
240 'value' => 'expertise',
241 'isDefault' => false,
242 'position' => 1
243 ],
244 [
245 'id' => 16,
246 'label' => BackendStrings::getTemplateStrings()['communication'],
247 'value' => 'communication',
248 'isDefault' => false,
249 'position' => 2
250 ],
251 [
252 'id' => 17,
253 'label' => BackendStrings::getTemplateStrings()['speed'],
254 'value' => 'speed',
255 'isDefault' => false,
256 'position' => 3
257 ],
258 [
259 'id' => 18,
260 'label' => BackendStrings::getTemplateStrings()['flexibility'],
261 'value' => 'flexibility',
262 'isDefault' => false,
263 'position' => 4
264 ],
265 [
266 'id' => 19,
267 'label' => BackendStrings::getTemplateStrings()['results'],
268 'value' => 'results',
269 'isDefault' => false,
270 'position' => 5
271 ],
272 ]
273 ]];
274 }
275
276 /**
277 * Additional comments paragraph field
278 *
279 * @return array<int, array<string, mixed>>
280 */
281 private static function getAdditionalCommentsParagraphField(): array
282 {
283 return [[
284 'id' => 21,
285 'fieldIndex' => 6,
286 'type' => 'textarea',
287 'label' => BackendStrings::getTemplateStrings()['additional_comments'],
288 'placeholder' => BackendStrings::getTemplateStrings()['additional_comments_placeholder'],
289 'required' => false,
290 'parentId' => null,
291 'defaultValue' => '',
292 'position' => 6,
293 'labelPosition' => 'default',
294 ]];
295 }
296
297 /**
298 * Standard rating options
299 *
300 * @return array<int, array<string, mixed>>
301 */
302 private static function getStandardRatingOptions(int $startId): array
303 {
304 return [
305 [
306 'id' => $startId,
307 'label' => BackendStrings::getNewFormStrings()['good'],
308 'value' => '1',
309 'isDefault' => false,
310 'position' => 1
311 ],
312 [
313 'id' => $startId + 1,
314 'label' => BackendStrings::getNewFormStrings()['nice'],
315 'value' => '2',
316 'isDefault' => false,
317 'position' => 2
318 ],
319 [
320 'id' => $startId + 2,
321 'label' => BackendStrings::getNewFormStrings()['very_good'],
322 'value' => '3',
323 'isDefault' => false,
324 'position' => 3
325 ],
326 [
327 'id' => $startId + 3,
328 'label' => BackendStrings::getNewFormStrings()['awesome'],
329 'value' => '4',
330 'isDefault' => false,
331 'position' => 4
332 ],
333 [
334 'id' => $startId + 4,
335 'label' => BackendStrings::getNewFormStrings()['amazing'],
336 'value' => '5',
337 'isDefault' => false,
338 'position' => 5
339 ],
340 ];
341 }
342 }
343