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

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

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