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

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

329 lines 10.9 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 GeneralClientFeedbackFormTemplate
13 {
14 /**
15 * Get the General Client Feedback Form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'general_client_feedback_form',
23 'name' => BackendStrings::getTemplateStrings()['general_client_feedback_form'],
24 'description' => BackendStrings::getTemplateStrings()['general_client_feedback_form_desc'],
25 'category' => 'feedback-forms',
26 'subcategory' => 'client-feedback-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'general-client-feedback-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['general_client_feedback_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getEngagementTypeDropdownField(),
37 self::getCollaborationRadioField(),
38 self::getOverallSatisfactionRatingField(),
39 self::getAreasStoodOutCheckboxField(),
40 self::getAdditionalFeedbackTextareaField(),
41 self::getEmailField()
42 ),
43 'settings' => []
44 ]
45 ];
46 }
47
48 /**
49 * Type of engagement dropdown field
50 *
51 * @return array<int, array<string, mixed>>
52 */
53 private static function getEngagementTypeDropdownField(): array
54 {
55 return [[
56 'id' => 6,
57 'fieldIndex' => 1,
58 'type' => 'select',
59 'label' => BackendStrings::getTemplateStrings()['type_of_engagement'],
60 'placeholder' => BackendStrings::getTemplateStrings()['select_engagement_type'],
61 'required' => true,
62 'parentId' => null,
63 'defaultValue' => '',
64 'position' => 1,
65 'fieldOptions' => [
66 [
67 'id' => 1,
68 'label' => BackendStrings::getTemplateStrings()['one_time_project'],
69 'value' => 'one_time_project',
70 'isDefault' => false,
71 'position' => 1
72 ],
73 [
74 'id' => 2,
75 'label' => BackendStrings::getTemplateStrings()['ongoing_retainer'],
76 'value' => 'ongoing_retainer',
77 'isDefault' => false,
78 'position' => 2
79 ],
80 [
81 'id' => 3,
82 'label' => BackendStrings::getTemplateStrings()['consulting'],
83 'value' => 'consulting',
84 'isDefault' => false,
85 'position' => 3
86 ],
87 [
88 'id' => 4,
89 'label' => BackendStrings::getTemplateStrings()['support_services'],
90 'value' => 'support_services',
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 * Collaboration description rating field
107 *
108 * @return array<int, array<string, mixed>>
109 */
110 private static function getCollaborationRadioField(): array
111 {
112 return [[
113 'id' => 11,
114 'fieldIndex' => 2,
115 'type' => 'rating',
116 'label' => BackendStrings::getTemplateStrings()['how_describe_collaboration'],
117 'required' => true,
118 'parentId' => null,
119 'defaultValue' => '',
120 'placeholder' => '',
121 'position' => 2,
122 'labelPosition' => 'default',
123 'ratingIcon' => 'star',
124 'fieldOptions' => [
125 [
126 'id' => 7,
127 'label' => BackendStrings::getTemplateStrings()['poor'],
128 'value' => 'poor',
129 'isDefault' => false,
130 'position' => 1
131 ],
132 [
133 'id' => 8,
134 'label' => BackendStrings::getTemplateStrings()['fair'],
135 'value' => 'fair',
136 'isDefault' => false,
137 'position' => 2
138 ],
139 [
140 'id' => 9,
141 'label' => BackendStrings::getNewFormStrings()['good'],
142 'value' => 'good',
143 'isDefault' => false,
144 'position' => 3
145 ],
146 [
147 'id' => 10,
148 'label' => BackendStrings::getTemplateStrings()['excellent'],
149 'value' => 'excellent',
150 'isDefault' => false,
151 'position' => 4
152 ],
153 ],
154 'showValues' => false,
155 'showRatingText' => true,
156 ]];
157 }
158
159 /**
160 * Overall client satisfaction rating field
161 *
162 * @return array<int, array<string, mixed>>
163 */
164 private static function getOverallSatisfactionRatingField(): array
165 {
166 return [[
167 'id' => 12,
168 'fieldIndex' => 3,
169 'type' => 'rating',
170 'label' => BackendStrings::getTemplateStrings()['overall_client_satisfaction'],
171 'required' => true,
172 'defaultValue' => '',
173 'placeholder' => '',
174 'position' => 3,
175 'labelPosition' => 'default',
176 'ratingIcon' => 'star',
177 'fieldOptions' => self::getStandardRatingOptions(10),
178 'showValues' => false,
179 'showRatingText' => true,
180 ]];
181 }
182
183 /**
184 * Areas that stood out checkbox field
185 *
186 * @return array<int, array<string, mixed>>
187 */
188 private static function getAreasStoodOutCheckboxField(): array
189 {
190 return [[
191 'id' => 18,
192 'fieldIndex' => 4,
193 'type' => 'checkbox',
194 'label' => BackendStrings::getTemplateStrings()['what_areas_stood_out'],
195 'required' => false,
196 'parentId' => null,
197 'defaultValue' => '',
198 'placeholder' => '',
199 'position' => 4,
200 'fieldOptions' => [
201 [
202 'id' => 13,
203 'label' => BackendStrings::getTemplateStrings()['communication'],
204 'value' => 'communication',
205 'isDefault' => false,
206 'position' => 1
207 ],
208 [
209 'id' => 14,
210 'label' => BackendStrings::getTemplateStrings()['expertise'],
211 'value' => 'expertise',
212 'isDefault' => false,
213 'position' => 2
214 ],
215 [
216 'id' => 15,
217 'label' => BackendStrings::getTemplateStrings()['timeliness'],
218 'value' => 'timeliness',
219 'isDefault' => false,
220 'position' => 3
221 ],
222 [
223 'id' => 16,
224 'label' => BackendStrings::getTemplateStrings()['quality_of_deliverables'],
225 'value' => 'quality_of_deliverables',
226 'isDefault' => false,
227 'position' => 4
228 ],
229 [
230 'id' => 17,
231 'label' => BackendStrings::getTemplateStrings()['flexibility'],
232 'value' => 'flexibility',
233 'isDefault' => false,
234 'position' => 5
235 ],
236 ]
237 ]];
238 }
239
240 /**
241 * Additional feedback textarea field
242 *
243 * @return array<int, array<string, mixed>>
244 */
245 private static function getAdditionalFeedbackTextareaField(): array
246 {
247 return [[
248 'id' => 19,
249 'fieldIndex' => 5,
250 'type' => 'textarea',
251 'label' => BackendStrings::getTemplateStrings()['additional_feedback'],
252 'placeholder' => BackendStrings::getTemplateStrings()['additional_feedback_placeholder'],
253 'required' => false,
254 'parentId' => null,
255 'defaultValue' => '',
256 'position' => 5,
257 'labelPosition' => 'default',
258 ]];
259 }
260
261 /**
262 * Email field
263 *
264 * @return array<int, array<string, mixed>>
265 */
266 private static function getEmailField(): array
267 {
268 return [[
269 'id' => 20,
270 'fieldIndex' => 6,
271 'type' => 'email',
272 'label' => BackendStrings::getNewFormStrings()['email'],
273 'placeholder' => BackendStrings::getTemplateStrings()['enter_email_address'],
274 'description' => BackendStrings::getTemplateStrings()['email_follow_up_description'],
275 'required' => false,
276 'parentId' => null,
277 'defaultValue' => '',
278 'position' => 6,
279 'labelPosition' => 'default',
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