PluginProbe
The Innovative Form Builder – IvyForms / 0.9.1
The Innovative Form Builder – IvyForms v0.9.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 / ProjectCompletionFeedbackFormTemplate.php

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

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