PluginProbe
The Innovative Form Builder – IvyForms / 1.5.1
The Innovative Form Builder – IvyForms v1.5.1
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 / GeneralClientFeedbackFormTemplate.php

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

338 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 use IvyForms\Services\Translations\BackendStrings;
6
7 class GeneralClientFeedbackFormTemplate
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' => 'general_client_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['general_client_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['general_client_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'client-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'general-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()['general_client_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getEngagementTypeDropdownField(),
45 self::getCollaborationRadioField(),
46 self::getOverallSatisfactionRatingField(),
47 self::getAreasStoodOutCheckboxField(),
48 self::getAdditionalFeedbackTextareaField(),
49 self::getEmailField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Type of engagement dropdown field
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getEngagementTypeDropdownField(): array
63 {
64 return [[
65 'id' => 6,
66 'fieldIndex' => 1,
67 'type' => 'select',
68 'label' => BackendStrings::getTemplateStrings()['type_of_engagement'],
69 'placeholder' => BackendStrings::getTemplateStrings()['select_engagement_type'],
70 'required' => true,
71 'parentId' => null,
72 'defaultValue' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'id' => 1,
77 'label' => BackendStrings::getTemplateStrings()['one_time_project'],
78 'value' => 'one_time_project',
79 'isDefault' => false,
80 'position' => 1
81 ],
82 [
83 'id' => 2,
84 'label' => BackendStrings::getTemplateStrings()['ongoing_retainer'],
85 'value' => 'ongoing_retainer',
86 'isDefault' => false,
87 'position' => 2
88 ],
89 [
90 'id' => 3,
91 'label' => BackendStrings::getTemplateStrings()['consulting'],
92 'value' => 'consulting',
93 'isDefault' => false,
94 'position' => 3
95 ],
96 [
97 'id' => 4,
98 'label' => BackendStrings::getTemplateStrings()['support_services'],
99 'value' => 'support_services',
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 * Collaboration description rating field
116 *
117 * @return array<int, array<string, mixed>>
118 */
119 private static function getCollaborationRadioField(): array
120 {
121 return [[
122 'id' => 11,
123 'fieldIndex' => 2,
124 'type' => 'rating',
125 'label' => BackendStrings::getTemplateStrings()['how_describe_collaboration'],
126 'required' => true,
127 'parentId' => null,
128 'defaultValue' => '',
129 'placeholder' => '',
130 'position' => 2,
131 'labelPosition' => 'default',
132 'ratingIcon' => 'star',
133 'fieldOptions' => [
134 [
135 'id' => 7,
136 'label' => BackendStrings::getTemplateStrings()['poor'],
137 'value' => 'poor',
138 'isDefault' => false,
139 'position' => 1
140 ],
141 [
142 'id' => 8,
143 'label' => BackendStrings::getTemplateStrings()['fair'],
144 'value' => 'fair',
145 'isDefault' => false,
146 'position' => 2
147 ],
148 [
149 'id' => 9,
150 'label' => BackendStrings::getNewFormStrings()['good'],
151 'value' => 'good',
152 'isDefault' => false,
153 'position' => 3
154 ],
155 [
156 'id' => 10,
157 'label' => BackendStrings::getTemplateStrings()['excellent'],
158 'value' => 'excellent',
159 'isDefault' => false,
160 'position' => 4
161 ],
162 ],
163 'showValues' => false,
164 'showRatingText' => true,
165 ]];
166 }
167
168 /**
169 * Overall client satisfaction rating field
170 *
171 * @return array<int, array<string, mixed>>
172 */
173 private static function getOverallSatisfactionRatingField(): array
174 {
175 return [[
176 'id' => 12,
177 'fieldIndex' => 3,
178 'type' => 'rating',
179 'label' => BackendStrings::getTemplateStrings()['overall_client_satisfaction'],
180 'required' => true,
181 'defaultValue' => '',
182 'placeholder' => '',
183 'position' => 3,
184 'labelPosition' => 'default',
185 'ratingIcon' => 'star',
186 'fieldOptions' => self::getStandardRatingOptions(10),
187 'showValues' => false,
188 'showRatingText' => true,
189 ]];
190 }
191
192 /**
193 * Areas that stood out checkbox field
194 *
195 * @return array<int, array<string, mixed>>
196 */
197 private static function getAreasStoodOutCheckboxField(): array
198 {
199 return [[
200 'id' => 18,
201 'fieldIndex' => 4,
202 'type' => 'checkbox',
203 'label' => BackendStrings::getTemplateStrings()['what_areas_stood_out'],
204 'required' => false,
205 'parentId' => null,
206 'defaultValue' => '',
207 'placeholder' => '',
208 'position' => 4,
209 'fieldOptions' => [
210 [
211 'id' => 13,
212 'label' => BackendStrings::getTemplateStrings()['communication'],
213 'value' => 'communication',
214 'isDefault' => false,
215 'position' => 1
216 ],
217 [
218 'id' => 14,
219 'label' => BackendStrings::getTemplateStrings()['expertise'],
220 'value' => 'expertise',
221 'isDefault' => false,
222 'position' => 2
223 ],
224 [
225 'id' => 15,
226 'label' => BackendStrings::getTemplateStrings()['timeliness'],
227 'value' => 'timeliness',
228 'isDefault' => false,
229 'position' => 3
230 ],
231 [
232 'id' => 16,
233 'label' => BackendStrings::getTemplateStrings()['quality_of_deliverables'],
234 'value' => 'quality_of_deliverables',
235 'isDefault' => false,
236 'position' => 4
237 ],
238 [
239 'id' => 17,
240 'label' => BackendStrings::getTemplateStrings()['flexibility'],
241 'value' => 'flexibility',
242 'isDefault' => false,
243 'position' => 5
244 ],
245 ]
246 ]];
247 }
248
249 /**
250 * Additional feedback textarea field
251 *
252 * @return array<int, array<string, mixed>>
253 */
254 private static function getAdditionalFeedbackTextareaField(): array
255 {
256 return [[
257 'id' => 19,
258 'fieldIndex' => 5,
259 'type' => 'textarea',
260 'label' => BackendStrings::getTemplateStrings()['additional_feedback'],
261 'placeholder' => BackendStrings::getTemplateStrings()['additional_feedback_placeholder'],
262 'required' => false,
263 'parentId' => null,
264 'defaultValue' => '',
265 'position' => 5,
266 'labelPosition' => 'default',
267 ]];
268 }
269
270 /**
271 * Email field
272 *
273 * @return array<int, array<string, mixed>>
274 */
275 private static function getEmailField(): array
276 {
277 return [[
278 'id' => 20,
279 'fieldIndex' => 6,
280 'type' => 'email',
281 'label' => BackendStrings::getNewFormStrings()['email'],
282 'placeholder' => BackendStrings::getTemplateStrings()['enter_email_address'],
283 'description' => BackendStrings::getTemplateStrings()['email_follow_up_description'],
284 'required' => false,
285 'parentId' => null,
286 'defaultValue' => '',
287 'position' => 6,
288 'labelPosition' => 'default',
289 ]];
290 }
291
292 /**
293 * Standard rating options
294 *
295 * @return array<int, array<string, mixed>>
296 */
297 private static function getStandardRatingOptions(int $startId): array
298 {
299 return [
300 [
301 'id' => $startId,
302 'label' => BackendStrings::getNewFormStrings()['good'],
303 'value' => '1',
304 'isDefault' => false,
305 'position' => 1
306 ],
307 [
308 'id' => $startId + 1,
309 'label' => BackendStrings::getNewFormStrings()['nice'],
310 'value' => '2',
311 'isDefault' => false,
312 'position' => 2
313 ],
314 [
315 'id' => $startId + 2,
316 'label' => BackendStrings::getNewFormStrings()['very_good'],
317 'value' => '3',
318 'isDefault' => false,
319 'position' => 3
320 ],
321 [
322 'id' => $startId + 3,
323 'label' => BackendStrings::getNewFormStrings()['awesome'],
324 'value' => '4',
325 'isDefault' => false,
326 'position' => 4
327 ],
328 [
329 'id' => $startId + 4,
330 'label' => BackendStrings::getNewFormStrings()['amazing'],
331 'value' => '5',
332 'isDefault' => false,
333 'position' => 5
334 ],
335 ];
336 }
337 }
338