PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / ProjectCompletionFeedbackFormTemplate.php

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

322 lines 10.4 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 ProjectCompletionFeedbackFormTemplate
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' => 'project_completion_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['project_completion_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['project_completion_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'client-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'project-completion-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()['project_completion_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getProjectIdNumberField(),
45 self::getProjectTypeDropdownField(),
46 self::getProjectOutcomeRatingField(),
47 self::getTimelinesDeliveryRatingField(),
48 self::getExpectationsMetRadioField(),
49 self::getWhatWentWellTextareaField(),
50 self::getImprovementSuggestionsTextareaField()
51 ),
52 'settings' => []
53 ]
54 ]
55 );
56 }
57
58 /**
59 * Project ID / Reference number field
60 *
61 * @return array<int, array<string, mixed>>
62 */
63 private static function getProjectIdNumberField(): array
64 {
65 return [[
66 'id' => 1,
67 'fieldIndex' => 1,
68 'type' => 'number',
69 'label' => BackendStrings::getTemplateStrings()['project_id_reference'],
70 'placeholder' => BackendStrings::getTemplateStrings()['project_id_placeholder'],
71 'required' => false,
72 'parentId' => null,
73 'defaultValue' => '',
74 'position' => 1,
75 'labelPosition' => 'default',
76 ]];
77 }
78
79 /**
80 * Project type dropdown field
81 *
82 * @return array<int, array<string, mixed>>
83 */
84 private static function getProjectTypeDropdownField(): array
85 {
86 return [[
87 'id' => 7,
88 'fieldIndex' => 2,
89 'type' => 'select',
90 'label' => BackendStrings::getTemplateStrings()['project_type'],
91 'placeholder' => BackendStrings::getTemplateStrings()['select_project_type'],
92 'required' => true,
93 'parentId' => null,
94 'defaultValue' => '',
95 'position' => 2,
96 'fieldOptions' => [
97 [
98 'id' => 2,
99 'label' => BackendStrings::getTemplateStrings()['design'],
100 'value' => 'design',
101 'isDefault' => false,
102 'position' => 1
103 ],
104 [
105 'id' => 3,
106 'label' => BackendStrings::getTemplateStrings()['development'],
107 'value' => 'development',
108 'isDefault' => false,
109 'position' => 2
110 ],
111 [
112 'id' => 4,
113 'label' => BackendStrings::getTemplateStrings()['marketing'],
114 'value' => 'marketing',
115 'isDefault' => false,
116 'position' => 3
117 ],
118 [
119 'id' => 5,
120 'label' => BackendStrings::getTemplateStrings()['consulting'],
121 'value' => 'consulting',
122 'isDefault' => false,
123 'position' => 4
124 ],
125 [
126 'id' => 6,
127 'label' => BackendStrings::getTemplateStrings()['other'],
128 'value' => 'other',
129 'isDefault' => false,
130 'position' => 5
131 ],
132 ]
133 ]];
134 }
135
136 /**
137 * Project outcome rating field
138 *
139 * @return array<int, array<string, mixed>>
140 */
141 private static function getProjectOutcomeRatingField(): array
142 {
143 return [[
144 'id' => 8,
145 'fieldIndex' => 3,
146 'type' => 'rating',
147 'label' => BackendStrings::getTemplateStrings()['project_outcome'],
148 'required' => true,
149 'defaultValue' => '',
150 'placeholder' => '',
151 'position' => 3,
152 'labelPosition' => 'default',
153 'ratingIcon' => 'star',
154 'fieldOptions' => self::getStandardRatingOptions(6),
155 'showValues' => false,
156 'showRatingText' => true,
157 ]];
158 }
159
160 /**
161 * Timeliness & delivery rating field
162 *
163 * @return array<int, array<string, mixed>>
164 */
165 private static function getTimelinesDeliveryRatingField(): array
166 {
167 return [[
168 'id' => 9,
169 'fieldIndex' => 4,
170 'type' => 'rating',
171 'label' => BackendStrings::getTemplateStrings()['timeliness_delivery'],
172 'required' => true,
173 'defaultValue' => '',
174 'placeholder' => '',
175 'position' => 4,
176 'labelPosition' => 'default',
177 'ratingIcon' => 'star',
178 'fieldOptions' => self::getStandardRatingOptions(11),
179 'showValues' => false,
180 'showRatingText' => true,
181 ]];
182 }
183
184 /**
185 * Did the project meet expectations radio field
186 *
187 * @return array<int, array<string, mixed>>
188 */
189 private static function getExpectationsMetRadioField(): array
190 {
191 return [[
192 'id' => 14,
193 'fieldIndex' => 5,
194 'type' => 'radio',
195 'label' => BackendStrings::getTemplateStrings()['meet_expectations'],
196 'required' => true,
197 'parentId' => null,
198 'defaultValue' => '',
199 'placeholder' => '',
200 'position' => 5,
201 'fieldOptions' => [
202 [
203 'id' => 10,
204 'label' => BackendStrings::getTemplateStrings()['exceeded_expectations'],
205 'value' => 'exceeded_expectations',
206 'isDefault' => false,
207 'position' => 1
208 ],
209 [
210 'id' => 11,
211 'label' => BackendStrings::getTemplateStrings()['met_expectations'],
212 'value' => 'met_expectations',
213 'isDefault' => false,
214 'position' => 2
215 ],
216 [
217 'id' => 12,
218 'label' => BackendStrings::getTemplateStrings()['partially_met_expectations'],
219 'value' => 'partially_met_expectations',
220 'isDefault' => false,
221 'position' => 3
222 ],
223 [
224 'id' => 13,
225 'label' => BackendStrings::getTemplateStrings()['did_not_meet_expectations'],
226 'value' => 'did_not_meet_expectations',
227 'isDefault' => false,
228 'position' => 4
229 ],
230 ]
231 ]];
232 }
233
234 /**
235 * What went well textarea field
236 *
237 * @return array<int, array<string, mixed>>
238 */
239 private static function getWhatWentWellTextareaField(): array
240 {
241 return [[
242 'id' => 15,
243 'fieldIndex' => 6,
244 'type' => 'textarea',
245 'label' => BackendStrings::getTemplateStrings()['what_went_well'],
246 'placeholder' => BackendStrings::getTemplateStrings()['what_went_well_placeholder'],
247 'required' => false,
248 'parentId' => null,
249 'defaultValue' => '',
250 'position' => 6,
251 'labelPosition' => 'default',
252 ]];
253 }
254
255 /**
256 * What could be improved textarea field
257 *
258 * @return array<int, array<string, mixed>>
259 */
260 private static function getImprovementSuggestionsTextareaField(): array
261 {
262 return [[
263 'id' => 16,
264 'fieldIndex' => 7,
265 'type' => 'textarea',
266 'label' => BackendStrings::getTemplateStrings()['what_could_be_improved'],
267 'placeholder' => BackendStrings::getTemplateStrings()['what_could_be_improved_placeholder'],
268 'required' => false,
269 'parentId' => null,
270 'defaultValue' => '',
271 'position' => 7,
272 'labelPosition' => 'default',
273 ]];
274 }
275
276 /**
277 * Standard rating options (nice, good, very good, awesome, amazing)
278 *
279 * @return array<int, array<string, mixed>>
280 */
281 private static function getStandardRatingOptions(int $startId): array
282 {
283 return [
284 [
285 'id' => $startId,
286 'label' => BackendStrings::getNewFormStrings()['nice'],
287 'value' => '1',
288 'isDefault' => false,
289 'position' => 1
290 ],
291 [
292 'id' => $startId + 1,
293 'label' => BackendStrings::getNewFormStrings()['good'],
294 'value' => '2',
295 'isDefault' => false,
296 'position' => 2
297 ],
298 [
299 'id' => $startId + 2,
300 'label' => BackendStrings::getNewFormStrings()['very_good'],
301 'value' => '3',
302 'isDefault' => false,
303 'position' => 3
304 ],
305 [
306 'id' => $startId + 3,
307 'label' => BackendStrings::getNewFormStrings()['awesome'],
308 'value' => '4',
309 'isDefault' => false,
310 'position' => 4
311 ],
312 [
313 'id' => $startId + 4,
314 'label' => BackendStrings::getNewFormStrings()['amazing'],
315 'value' => '5',
316 'isDefault' => false,
317 'position' => 5
318 ],
319 ];
320 }
321 }
322