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

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

282 lines 9.0 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 ConferenceFeedbackFormTemplate
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' => 'conference_feedback_form',
18 'name' => BackendStrings::getTemplateStrings()['conference_feedback_form'],
19 'description' => BackendStrings::getTemplateStrings()['conference_feedback_form_desc'],
20 'category' => 'feedback-forms',
21 'subcategory' => 'event-feedback-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'conference-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()['conference_feedback_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getSessionsAttendedField(),
45 self::getSpeakerQualityRatingField(),
46 self::getVenueLogisticsRatingField(),
47 self::getOverallOrganizationDropdownField(),
48 self::getImprovementTextareaField()
49 ),
50 'settings' => []
51 ]
52 ]
53 );
54 }
55
56 /**
57 * Checkbox: Sessions attended
58 *
59 * @return array<int, array<string, mixed>>
60 */
61 private static function getSessionsAttendedField(): array
62 {
63 return [[
64 'id' => 6,
65 'fieldIndex' => 1,
66 'type' => 'checkbox',
67 'label' => BackendStrings::getTemplateStrings()['sessions_attended'],
68 'required' => true,
69 'parentId' => null,
70 'defaultValue' => '',
71 'placeholder' => '',
72 'position' => 1,
73 'fieldOptions' => [
74 [
75 'id' => 1,
76 'label' => BackendStrings::getTemplateStrings()['keynote_sessions'],
77 'value' => 'keynote_sessions',
78 'isDefault' => false,
79 'position' => 1,
80 ],
81 [
82 'id' => 2,
83 'label' => BackendStrings::getTemplateStrings()['technical_sessions'],
84 'value' => 'technical_sessions',
85 'isDefault' => false,
86 'position' => 2,
87 ],
88 [
89 'id' => 3,
90 'label' => BackendStrings::getTemplateStrings()['panel_discussions'],
91 'value' => 'panel_discussions',
92 'isDefault' => false,
93 'position' => 3,
94 ],
95 [
96 'id' => 4,
97 'label' => BackendStrings::getTemplateStrings()['workshops_sessions'],
98 'value' => 'workshops',
99 'isDefault' => false,
100 'position' => 4,
101 ],
102 [
103 'id' => 5,
104 'label' => BackendStrings::getTemplateStrings()['networking_sessions'],
105 'value' => 'networking_sessions',
106 'isDefault' => false,
107 'position' => 5,
108 ],
109 ]
110 ]];
111 }
112
113 /**
114 * Rating: Speaker quality
115 *
116 * @return array<int, array<string, mixed>>
117 */
118 private static function getSpeakerQualityRatingField(): array
119 {
120 return [[
121 'id' => 7,
122 'fieldIndex' => 2,
123 'type' => 'rating',
124 'label' => BackendStrings::getTemplateStrings()['speaker_quality'],
125 'required' => true,
126 'defaultValue' => '',
127 'placeholder' => '',
128 'position' => 2,
129 'labelPosition' => 'default',
130 'ratingIcon' => 'star',
131 'fieldOptions' => self::getStandardRatingOptions(1),
132 'showValues' => false,
133 'showRatingText' => true,
134 ]];
135 }
136
137 /**
138 * Rating: Venue & logistics
139 *
140 * @return array<int, array<string, mixed>>
141 */
142 private static function getVenueLogisticsRatingField(): array
143 {
144 return [[
145 'id' => 8,
146 'fieldIndex' => 3,
147 'type' => 'rating',
148 'label' => BackendStrings::getTemplateStrings()['venue_and_logistics'],
149 'required' => true,
150 'defaultValue' => '',
151 'placeholder' => '',
152 'position' => 3,
153 'labelPosition' => 'default',
154 'ratingIcon' => 'star',
155 'fieldOptions' => self::getStandardRatingOptions(6),
156 'showValues' => false,
157 'showRatingText' => true,
158 ]];
159 }
160
161 /**
162 * Rating: Overall conference organization
163 *
164 * @return array<int, array<string, mixed>>
165 */
166 private static function getOverallOrganizationDropdownField(): array
167 {
168 return [[
169 'id' => 13,
170 'fieldIndex' => 4,
171 'type' => 'rating',
172 'label' => BackendStrings::getTemplateStrings()['overall_conference_organization'],
173 'required' => true,
174 'parentId' => null,
175 'defaultValue' => '',
176 'placeholder' => '',
177 'position' => 4,
178 'labelPosition' => 'default',
179 'ratingIcon' => 'star',
180 'fieldOptions' => [
181 [
182 'id' => 9,
183 'label' => BackendStrings::getTemplateStrings()['organization_poor'],
184 'value' => 'poor',
185 'isDefault' => false,
186 'position' => 1,
187 ],
188 [
189 'id' => 10,
190 'label' => BackendStrings::getTemplateStrings()['organization_average'],
191 'value' => 'average',
192 'isDefault' => false,
193 'position' => 2,
194 ],
195 [
196 'id' => 11,
197 'label' => BackendStrings::getTemplateStrings()['organization_good'],
198 'value' => 'good',
199 'isDefault' => false,
200 'position' => 3,
201 ],
202 [
203 'id' => 12,
204 'label' => BackendStrings::getTemplateStrings()['organization_excellent'],
205 'value' => 'excellent',
206 'isDefault' => false,
207 'position' => 4,
208 ],
209 ],
210 'showValues' => false,
211 'showRatingText' => true,
212 ]];
213 }
214
215 /**
216 * Paragraph: What could be improved?
217 *
218 * @return array<int, array<string, mixed>>
219 */
220 private static function getImprovementTextareaField(): array
221 {
222 return [[
223 'id' => 14,
224 'fieldIndex' => 5,
225 'type' => 'textarea',
226 'label' => BackendStrings::getTemplateStrings()['what_could_be_improved'],
227 'placeholder' => BackendStrings::getTemplateStrings()['share_what_could_be_improved'],
228 'required' => false,
229 'parentId' => null,
230 'defaultValue' => '',
231 'position' => 5,
232 'labelPosition' => 'default',
233 ]];
234 }
235
236 /**
237 * Standard rating options (1-5)
238 *
239 * @return array<int, array<string, mixed>>
240 */
241 private static function getStandardRatingOptions(int $startId): array
242 {
243 return [
244 [
245 'id' => $startId,
246 'label' => BackendStrings::getNewFormStrings()['good'],
247 'value' => '1',
248 'isDefault' => false,
249 'position' => 1,
250 ],
251 [
252 'id' => $startId + 1,
253 'label' => BackendStrings::getNewFormStrings()['nice'],
254 'value' => '2',
255 'isDefault' => false,
256 'position' => 2,
257 ],
258 [
259 'id' => $startId + 2,
260 'label' => BackendStrings::getNewFormStrings()['very_good'],
261 'value' => '3',
262 'isDefault' => false,
263 'position' => 3,
264 ],
265 [
266 'id' => $startId + 3,
267 'label' => BackendStrings::getNewFormStrings()['awesome'],
268 'value' => '4',
269 'isDefault' => false,
270 'position' => 4,
271 ],
272 [
273 'id' => $startId + 4,
274 'label' => BackendStrings::getNewFormStrings()['amazing'],
275 'value' => '5',
276 'isDefault' => false,
277 'position' => 5,
278 ],
279 ];
280 }
281 }
282