PluginProbe
The Innovative Form Builder – IvyForms / 1.4
The Innovative Form Builder – IvyForms v1.4
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 / OngoingClientFeedbackFormTemplate.php

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

302 lines 9.8 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 OngoingClientFeedbackFormTemplate
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' => 'ongoing_client_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['ongoing_client_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['ongoing_client_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'client-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'ongoing-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()['ongoing_client_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getLengthOfCollaborationRadioField(),
45 self::getOverallSatisfactionRatingField(),
46 self::getCommunicationResponsivenessRatingField(),
47 self::getServicesUsedCheckboxField(),
48 self::getSuggestionsForImprovementParagraphField(),
49 self::getPhoneNumberField()
50 ),
51 'settings' => []
52 ]
53 ]
54 );
55 }
56
57 /**
58 * Length of collaboration radio field
59 *
60 * @return array<int, array<string, mixed>>
61 */
62 private static function getLengthOfCollaborationRadioField(): array
63 {
64 return [[
65 'id' => 5,
66 'fieldIndex' => 1,
67 'type' => 'radio',
68 'label' => BackendStrings::getTemplateStrings()['length_of_collaboration'],
69 'required' => true,
70 'parentId' => null,
71 'defaultValue' => '',
72 'placeholder' => '',
73 'position' => 1,
74 'fieldOptions' => [
75 [
76 'id' => 1,
77 'label' => BackendStrings::getTemplateStrings()['less_than_3_months'],
78 'value' => 'less_than_3_months',
79 'isDefault' => false,
80 'position' => 1
81 ],
82 [
83 'id' => 2,
84 'label' => BackendStrings::getTemplateStrings()['three_to_six_months'],
85 'value' => '3_6_months',
86 'isDefault' => false,
87 'position' => 2
88 ],
89 [
90 'id' => 3,
91 'label' => BackendStrings::getTemplateStrings()['six_to_twelve_months'],
92 'value' => '6_12_months',
93 'isDefault' => false,
94 'position' => 3
95 ],
96 [
97 'id' => 4,
98 'label' => BackendStrings::getTemplateStrings()['more_than_1_year'],
99 'value' => 'more_than_1_year',
100 'isDefault' => false,
101 'position' => 4
102 ],
103 ]
104 ]];
105 }
106
107 /**
108 * Overall satisfaction rating field
109 *
110 * @return array<int, array<string, mixed>>
111 */
112 private static function getOverallSatisfactionRatingField(): array
113 {
114 return [[
115 'id' => 6,
116 'fieldIndex' => 2,
117 'type' => 'rating',
118 'label' => BackendStrings::getTemplateStrings()['overall_satisfaction'],
119 'required' => true,
120 'defaultValue' => '',
121 'placeholder' => '',
122 'position' => 2,
123 'labelPosition' => 'default',
124 'ratingIcon' => 'star',
125 'fieldOptions' => self::getStandardRatingOptions(5),
126 'showValues' => false,
127 'showRatingText' => true,
128 ]];
129 }
130
131 /**
132 * Communication & responsiveness rating field
133 *
134 * @return array<int, array<string, mixed>>
135 */
136 private static function getCommunicationResponsivenessRatingField(): array
137 {
138 return [[
139 'id' => 7,
140 'fieldIndex' => 3,
141 'type' => 'rating',
142 'label' => BackendStrings::getTemplateStrings()['communication_responsiveness'],
143 'required' => true,
144 'defaultValue' => '',
145 'placeholder' => '',
146 'position' => 3,
147 'labelPosition' => 'default',
148 'ratingIcon' => 'star',
149 'fieldOptions' => self::getStandardRatingOptions(10),
150 'showValues' => false,
151 'showRatingText' => true,
152 ]];
153 }
154
155 /**
156 * Services used checkbox field
157 *
158 * @return array<int, array<string, mixed>>
159 */
160 private static function getServicesUsedCheckboxField(): array
161 {
162 return [[
163 'id' => 13,
164 'fieldIndex' => 4,
165 'type' => 'checkbox',
166 'label' => BackendStrings::getTemplateStrings()['services_used'],
167 'required' => false,
168 'parentId' => null,
169 'defaultValue' => '',
170 'placeholder' => '',
171 'position' => 4,
172 'fieldOptions' => [
173 [
174 'id' => 8,
175 'label' => BackendStrings::getTemplateStrings()['strategy_planning'],
176 'value' => 'strategy_planning',
177 'isDefault' => false,
178 'position' => 1
179 ],
180 [
181 'id' => 9,
182 'label' => BackendStrings::getTemplateStrings()['ongoing_support'],
183 'value' => 'ongoing_support',
184 'isDefault' => false,
185 'position' => 2
186 ],
187 [
188 'id' => 10,
189 'label' => BackendStrings::getTemplateStrings()['maintenance'],
190 'value' => 'maintenance',
191 'isDefault' => false,
192 'position' => 3
193 ],
194 [
195 'id' => 11,
196 'label' => BackendStrings::getTemplateStrings()['consulting'],
197 'value' => 'consulting',
198 'isDefault' => false,
199 'position' => 4
200 ],
201 [
202 'id' => 12,
203 'label' => BackendStrings::getTemplateStrings()['reporting_analytics'],
204 'value' => 'reporting_analytics',
205 'isDefault' => false,
206 'position' => 5
207 ],
208 ]
209 ]];
210 }
211
212 /**
213 * Suggestions for improvement paragraph field
214 *
215 * @return array<int, array<string, mixed>>
216 */
217 private static function getSuggestionsForImprovementParagraphField(): array
218 {
219 return [[
220 'id' => 14,
221 'fieldIndex' => 5,
222 'type' => 'textarea',
223 'label' => BackendStrings::getTemplateStrings()['suggestions_for_improvement'],
224 'placeholder' => BackendStrings::getTemplateStrings()['suggestions_for_improvement_placeholder'],
225 'required' => false,
226 'parentId' => null,
227 'defaultValue' => '',
228 'position' => 5,
229 'labelPosition' => 'default',
230 ]];
231 }
232
233 /**
234 * Phone number field
235 *
236 * @return array<int, array<string, mixed>>
237 */
238 private static function getPhoneNumberField(): array
239 {
240 return [[
241 'id' => 15,
242 'fieldIndex' => 6,
243 'type' => 'phone',
244 'label' => BackendStrings::getTemplateStrings()['phone_number'],
245 'placeholder' => '+1 (_) _-_',
246 'description' => BackendStrings::getTemplateStrings()['phone_follow_up_description'],
247 'required' => false,
248 'parentId' => null,
249 'defaultValue' => '',
250 'position' => 6,
251 'labelPosition' => 'default',
252 'phoneAutoDetect' => true,
253 ]];
254 }
255
256 /**
257 * Standard rating options
258 *
259 * @return array<int, array<string, mixed>>
260 */
261 private static function getStandardRatingOptions(int $startId): array
262 {
263 return [
264 [
265 'id' => $startId,
266 'label' => BackendStrings::getNewFormStrings()['good'],
267 'value' => '1',
268 'isDefault' => false,
269 'position' => 1
270 ],
271 [
272 'id' => $startId + 1,
273 'label' => BackendStrings::getNewFormStrings()['nice'],
274 'value' => '2',
275 'isDefault' => false,
276 'position' => 2
277 ],
278 [
279 'id' => $startId + 2,
280 'label' => BackendStrings::getNewFormStrings()['very_good'],
281 'value' => '3',
282 'isDefault' => false,
283 'position' => 3
284 ],
285 [
286 'id' => $startId + 3,
287 'label' => BackendStrings::getNewFormStrings()['awesome'],
288 'value' => '4',
289 'isDefault' => false,
290 'position' => 4
291 ],
292 [
293 'id' => $startId + 4,
294 'label' => BackendStrings::getNewFormStrings()['amazing'],
295 'value' => '5',
296 'isDefault' => false,
297 'position' => 5
298 ],
299 ];
300 }
301 }
302