PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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.0, at backend/src/Services/Template/ProjectCompletionFeedbackFormTemplate.php

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