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

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

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