@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /* @var EE_Question[] $all_questions */ |
14 | 14 | assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
15 | 15 | foreach ($all_questions as $unused_question) { |
16 | - assert($unused_question); |
|
17 | - assert($unused_question instanceof EE_Question); |
|
16 | + assert($unused_question); |
|
17 | + assert($unused_question instanceof EE_Question); |
|
18 | 18 | } |
19 | 19 | /* @var array $values . Array of arrays, where each sub-array contains 2 keys: 'id' (internal value) and 'name' (label for displaying) */ |
20 | 20 | assert(is_array($values)); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | <th> |
34 | 34 | <label for="QSG_name"> |
35 | 35 | <?php esc_html_e('Group Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
36 | - 'group_name_info' |
|
37 | - ); ?> |
|
36 | + 'group_name_info' |
|
37 | + ); ?> |
|
38 | 38 | </label> |
39 | 39 | </th> |
40 | 40 | <td> |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | <th> |
49 | 49 | <label for="QSG_identifier"> |
50 | 50 | <?php esc_html_e('Group Identifier', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
51 | - 'group_identifier_info' |
|
52 | - ); ?> |
|
51 | + 'group_identifier_info' |
|
52 | + ); ?> |
|
53 | 53 | </label> |
54 | 54 | </th> |
55 | 55 | <td> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | <th> |
69 | 69 | <label for="QSG_desc"> |
70 | 70 | <?php esc_html_e('Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
71 | - 'group_description_info' |
|
72 | - ); ?> |
|
71 | + 'group_description_info' |
|
72 | + ); ?> |
|
73 | 73 | </label> |
74 | 74 | </th> |
75 | 75 | <td> |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | <th> |
83 | 83 | <label for="QSG_order"> |
84 | 84 | <?php esc_html_e('Question Group Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
85 | - 'group_order_info' |
|
86 | - ); ?> |
|
85 | + 'group_order_info' |
|
86 | + ); ?> |
|
87 | 87 | </label> |
88 | 88 | </th> |
89 | 89 | <td> |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | <th> |
97 | 97 | <label> |
98 | 98 | <?php esc_html_e('Show Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
99 | - 'show_group_name_info' |
|
100 | - ); ?> |
|
99 | + 'show_group_name_info' |
|
100 | + ); ?> |
|
101 | 101 | </label> |
102 | 102 | </th> |
103 | 103 | <td> |
104 | 104 | <label for="QSG_show_group_name"> |
105 | 105 | <?php echo EEH_Form_Fields::select_input( |
106 | - 'QSG_show_group_name', |
|
107 | - $values, |
|
108 | - $question_group->show_group_name() |
|
109 | - ); ?> |
|
106 | + 'QSG_show_group_name', |
|
107 | + $values, |
|
108 | + $question_group->show_group_name() |
|
109 | + ); ?> |
|
110 | 110 | <p class="description"><?php esc_html_e('Show Group Name on Registration Page?', 'event_espresso'); ?></p> |
111 | 111 | </label> |
112 | 112 | </td> |
@@ -116,20 +116,20 @@ discard block |
||
116 | 116 | <th> |
117 | 117 | <label> |
118 | 118 | <?php esc_html_e(' Show Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
119 | - 'show_group_description_info' |
|
120 | - ); ?> |
|
119 | + 'show_group_description_info' |
|
120 | + ); ?> |
|
121 | 121 | </label> |
122 | 122 | </th> |
123 | 123 | <td> |
124 | 124 | <label for="QSG_show_group_order"> |
125 | 125 | <?php echo EEH_Form_Fields::select_input( |
126 | - 'QSG_show_group_desc', |
|
127 | - $values, |
|
128 | - $question_group->show_group_desc() |
|
129 | - ); ?> |
|
126 | + 'QSG_show_group_desc', |
|
127 | + $values, |
|
128 | + $question_group->show_group_desc() |
|
129 | + ); ?> |
|
130 | 130 | <p class="description"><?php |
131 | - esc_html_e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
132 | - ?></p> |
|
131 | + esc_html_e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
132 | + ?></p> |
|
133 | 133 | </label> |
134 | 134 | <input type="hidden" name="QSG_system" value="<?php echo esc_attr($question_group->system_group()); ?>"> |
135 | 135 | </td> |
@@ -145,85 +145,85 @@ discard block |
||
145 | 145 | <div class="form-table question-group-questions inside"> |
146 | 146 | <div class="padding"> |
147 | 147 | <p><span class="description"><?php |
148 | - esc_html_e( |
|
149 | - 'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', |
|
150 | - 'event_espresso' |
|
151 | - ); ?></span></p> |
|
148 | + esc_html_e( |
|
149 | + 'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', |
|
150 | + 'event_espresso' |
|
151 | + ); ?></span></p> |
|
152 | 152 | <div> |
153 | 153 | <ul class="question-list-sortable"> |
154 | 154 | <?php |
155 | - $question_order = 0; |
|
156 | - $question_group_questions = $question_group->questions(); |
|
157 | - foreach ($all_questions as $question_ID => $question) { |
|
158 | - if ($question instanceof EE_Question) { |
|
159 | - /*@var $question EE_Question*/ |
|
160 | - $checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : ''; |
|
161 | - // disable questions from the personal information question group |
|
162 | - // is it required in the current question group? if so don't allow admins to remove it |
|
163 | - $disabled = in_array( |
|
164 | - $question->system_ID(), |
|
165 | - EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
166 | - $QSG_system |
|
167 | - ) |
|
168 | - ) ? 'disabled' : ''; |
|
169 | - // limit where system questions can appear |
|
170 | - if ( |
|
171 | - $question->system_ID() && |
|
172 | - ! in_array( |
|
173 | - $question->system_ID(), |
|
174 | - EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
175 | - $QSG_system |
|
176 | - ) |
|
177 | - ) |
|
178 | - ) { |
|
179 | - continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions). The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions. |
|
180 | - } |
|
181 | - ?> |
|
155 | + $question_order = 0; |
|
156 | + $question_group_questions = $question_group->questions(); |
|
157 | + foreach ($all_questions as $question_ID => $question) { |
|
158 | + if ($question instanceof EE_Question) { |
|
159 | + /*@var $question EE_Question*/ |
|
160 | + $checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : ''; |
|
161 | + // disable questions from the personal information question group |
|
162 | + // is it required in the current question group? if so don't allow admins to remove it |
|
163 | + $disabled = in_array( |
|
164 | + $question->system_ID(), |
|
165 | + EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
166 | + $QSG_system |
|
167 | + ) |
|
168 | + ) ? 'disabled' : ''; |
|
169 | + // limit where system questions can appear |
|
170 | + if ( |
|
171 | + $question->system_ID() && |
|
172 | + ! in_array( |
|
173 | + $question->system_ID(), |
|
174 | + EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
175 | + $QSG_system |
|
176 | + ) |
|
177 | + ) |
|
178 | + ) { |
|
179 | + continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions). The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions. |
|
180 | + } |
|
181 | + ?> |
|
182 | 182 | <li class="ee-question-sortable"> |
183 | 183 | <label for="question-<?php echo absint($question_ID); ?>"> |
184 | 184 | <input type="checkbox" name="questions[<?php echo absint($question_ID); ?>]" |
185 | 185 | id="question-<?php echo absint($question_ID); ?>" |
186 | 186 | value="<?php echo absint($question_ID); ?>" <?php echo esc_attr($disabled); ?> <?php echo esc_attr($checked); ?>> |
187 | 187 | <span class="question-text"><?php |
188 | - echo trim($question->display_text()) |
|
189 | - . (95 <= strlen(trim($question->display_text())) |
|
190 | - ? "…" |
|
191 | - : ''); |
|
192 | - ?> |
|
188 | + echo trim($question->display_text()) |
|
189 | + . (95 <= strlen(trim($question->display_text())) |
|
190 | + ? "…" |
|
191 | + : ''); |
|
192 | + ?> |
|
193 | 193 | </span> |
194 | 194 | <input class="question-group-QGQ_order" type="hidden" |
195 | 195 | name="question_orders[<?php echo absint($question_ID); ?>]" |
196 | 196 | value="<?php echo esc_attr($question_order); ?>"> |
197 | 197 | </label> |
198 | 198 | <?php |
199 | - if ( |
|
200 | - EE_Registry::instance()->CAP->current_user_can( |
|
201 | - 'ee_edit_question', |
|
202 | - 'espresso_registration_form_edit_question', |
|
203 | - $question->ID() |
|
204 | - ) |
|
205 | - ) { |
|
206 | - $edit_query_args = array( |
|
207 | - 'action' => 'edit_question', |
|
208 | - 'QST_ID' => $question->ID(), |
|
209 | - ); |
|
210 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
199 | + if ( |
|
200 | + EE_Registry::instance()->CAP->current_user_can( |
|
201 | + 'ee_edit_question', |
|
202 | + 'espresso_registration_form_edit_question', |
|
203 | + $question->ID() |
|
204 | + ) |
|
205 | + ) { |
|
206 | + $edit_query_args = array( |
|
207 | + 'action' => 'edit_question', |
|
208 | + 'QST_ID' => $question->ID(), |
|
209 | + ); |
|
210 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
211 | 211 | |
212 | - echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
213 | - sprintf( |
|
214 | - esc_attr__('Edit %s', 'event_espresso'), |
|
215 | - $question->admin_label() |
|
216 | - ) |
|
217 | - . '"><span class="dashicons dashicons-edit"></span> |
|
212 | + echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
213 | + sprintf( |
|
214 | + esc_attr__('Edit %s', 'event_espresso'), |
|
215 | + $question->admin_label() |
|
216 | + ) |
|
217 | + . '"><span class="dashicons dashicons-edit"></span> |
|
218 | 218 | </a>'; |
219 | - } |
|
220 | - ?> |
|
219 | + } |
|
220 | + ?> |
|
221 | 221 | </li> |
222 | 222 | <?php |
223 | - $question_order++; |
|
224 | - } |
|
225 | - } |
|
226 | - ?> |
|
223 | + $question_order++; |
|
224 | + } |
|
225 | + } |
|
226 | + ?> |
|
227 | 227 | </ul> |
228 | 228 | </div> |
229 | 229 | </div> |