PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
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 0.9, at backend/src/Services/Template/ServiceSpecificClientFeedbackFormTemplate.php

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