@@ -19,32 +19,32 @@ discard block |
||
| 19 | 19 | $has_answers = $question->has_answers(); |
| 20 | 20 | |
| 21 | 21 | if ($QST_system === 'country') { |
| 22 | - echo EEH_HTML::div( |
|
| 23 | - EEH_HTML::h4( |
|
| 24 | - '<span class="dashicons dashicons-info"></span>' . esc_html__('Did you know...', 'event_espresso') |
|
| 25 | - ) . |
|
| 26 | - EEH_HTML::p( |
|
| 27 | - esc_html__( |
|
| 28 | - 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
| 29 | - 'event_espresso' |
|
| 30 | - ) |
|
| 31 | - ), |
|
| 32 | - '', |
|
| 33 | - 'ee-info-box' |
|
| 34 | - ); |
|
| 22 | + echo EEH_HTML::div( |
|
| 23 | + EEH_HTML::h4( |
|
| 24 | + '<span class="dashicons dashicons-info"></span>' . esc_html__('Did you know...', 'event_espresso') |
|
| 25 | + ) . |
|
| 26 | + EEH_HTML::p( |
|
| 27 | + esc_html__( |
|
| 28 | + 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
|
| 29 | + 'event_espresso' |
|
| 30 | + ) |
|
| 31 | + ), |
|
| 32 | + '', |
|
| 33 | + 'ee-info-box' |
|
| 34 | + ); |
|
| 35 | 35 | } |
| 36 | 36 | ?> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | - do_action('AHEE__questions_main_meta_box__template__inner_admin_page_content', $question); |
|
| 39 | + do_action('AHEE__questions_main_meta_box__template__inner_admin_page_content', $question); |
|
| 40 | 40 | ?> |
| 41 | 41 | |
| 42 | 42 | <div class="padding"> |
| 43 | 43 | <table class="form-table"> |
| 44 | 44 | <tbody> |
| 45 | 45 | <?php |
| 46 | - do_action('AHEE__questions_main_meta_box__template__before_table_form_table', $question); |
|
| 47 | - ?> |
|
| 46 | + do_action('AHEE__questions_main_meta_box__template__before_table_form_table', $question); |
|
| 47 | + ?> |
|
| 48 | 48 | <tr> |
| 49 | 49 | <th> |
| 50 | 50 | <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | </th> |
| 65 | 65 | <td> |
| 66 | 66 | <?php |
| 67 | - $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 68 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 69 | - ?> |
|
| 67 | + $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 68 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 69 | + ?> |
|
| 70 | 70 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id ?>" |
| 71 | 71 | name="QST_admin_label<?php echo $id ?>" |
| 72 | 72 | value="<?php $question->f('QST_admin_label') ?>"<?php echo $disabled_attr ?>/> |
@@ -95,18 +95,18 @@ discard block |
||
| 95 | 95 | </th> |
| 96 | 96 | <td> |
| 97 | 97 | <?php |
| 98 | - $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 99 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 100 | - $admin_only = $question->get('QST_admin_only'); |
|
| 101 | - $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
| 102 | - ?> |
|
| 98 | + $disabled_attr = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
| 99 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 100 | + $admin_only = $question->get('QST_admin_only'); |
|
| 101 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
| 102 | + ?> |
|
| 103 | 103 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" |
| 104 | 104 | name="QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled_attr; |
| 105 | - echo $checked; ?>/> |
|
| 105 | + echo $checked; ?>/> |
|
| 106 | 106 | <br/> |
| 107 | 107 | <p class="description"> |
| 108 | 108 | <?php |
| 109 | - if (! empty($QST_system)) { ?> |
|
| 109 | + if (! empty($QST_system)) { ?> |
|
| 110 | 110 | <span class="description" style="color:#D54E21;"> |
| 111 | 111 | <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso') ?> |
| 112 | 112 | </span> |
@@ -123,32 +123,32 @@ discard block |
||
| 123 | 123 | </th> |
| 124 | 124 | <td> |
| 125 | 125 | <?php |
| 126 | - $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 127 | - if ($disabled) { |
|
| 128 | - $disabled_attr = 'disabled="disabled"'; |
|
| 129 | - $id = '_disabled'; |
|
| 130 | - } else { |
|
| 131 | - $disabled_attr = ''; |
|
| 132 | - $id = ''; |
|
| 133 | - } |
|
| 126 | + $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 127 | + if ($disabled) { |
|
| 128 | + $disabled_attr = 'disabled="disabled"'; |
|
| 129 | + $id = '_disabled'; |
|
| 130 | + } else { |
|
| 131 | + $disabled_attr = ''; |
|
| 132 | + $id = ''; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - echo EEH_Form_Fields::select_input( |
|
| 136 | - 'QST_type' . $id, |
|
| 137 | - $question_types, |
|
| 138 | - $question->type(), |
|
| 139 | - 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 140 | - ); |
|
| 141 | - if ($disabled) { ?> |
|
| 135 | + echo EEH_Form_Fields::select_input( |
|
| 136 | + 'QST_type' . $id, |
|
| 137 | + $question_types, |
|
| 138 | + $question->type(), |
|
| 139 | + 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 140 | + ); |
|
| 141 | + if ($disabled) { ?> |
|
| 142 | 142 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type() ?>"/> |
| 143 | 143 | <?php |
| 144 | - $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
| 145 | - } else { |
|
| 146 | - $explanatory_text = esc_html__( |
|
| 147 | - 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
| 148 | - 'event_espresso' |
|
| 149 | - ); |
|
| 150 | - } |
|
| 151 | - if ($disabled || $has_answers) { ?> |
|
| 144 | + $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
| 145 | + } else { |
|
| 146 | + $explanatory_text = esc_html__( |
|
| 147 | + 'Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', |
|
| 148 | + 'event_espresso' |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | + if ($disabled || $has_answers) { ?> |
|
| 152 | 152 | <p><span class="description" style="color:#D54E21;"> |
| 153 | 153 | <?php echo $explanatory_text; ?> |
| 154 | 154 | </span></p> |
@@ -166,25 +166,25 @@ discard block |
||
| 166 | 166 | </th> |
| 167 | 167 | <td> |
| 168 | 168 | <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' |
| 169 | - : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
| 169 | + : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
| 170 | 170 | <p> |
| 171 | 171 | <span class="description"> |
| 172 | 172 | <?php esc_html_e( |
| 173 | - 'Maximum number of characters allowed when answering this question', |
|
| 174 | - 'event_espresso' |
|
| 175 | - ); ?> |
|
| 173 | + 'Maximum number of characters allowed when answering this question', |
|
| 174 | + 'event_espresso' |
|
| 175 | + ); ?> |
|
| 176 | 176 | </span> |
| 177 | 177 | </p> |
| 178 | 178 | <?php if ($QST_system) { ?> |
| 179 | 179 | <p> |
| 180 | 180 | <span class="description" style="color:#D54E21;"> |
| 181 | 181 | <?php printf( |
| 182 | - esc_html__( |
|
| 183 | - 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 184 | - 'event_espresso' |
|
| 185 | - ), |
|
| 186 | - $max_max |
|
| 187 | - ); ?> |
|
| 182 | + esc_html__( |
|
| 183 | + 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 184 | + 'event_espresso' |
|
| 185 | + ), |
|
| 186 | + $max_max |
|
| 187 | + ); ?> |
|
| 188 | 188 | </span> |
| 189 | 189 | </p> |
| 190 | 190 | <?php } ?> |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | </th> |
| 207 | 207 | <th class="option-desc-header"> |
| 208 | 208 | <?php esc_html_e( |
| 209 | - 'Description (optional, only shown on registration form)', |
|
| 210 | - 'event_espresso' |
|
| 211 | - ) ?> |
|
| 209 | + 'Description (optional, only shown on registration form)', |
|
| 210 | + 'event_espresso' |
|
| 211 | + ) ?> |
|
| 212 | 212 | </th> |
| 213 | 213 | <th> |
| 214 | 214 | </th> |
@@ -234,12 +234,12 @@ discard block |
||
| 234 | 234 | </tr> |
| 235 | 235 | |
| 236 | 236 | <?php |
| 237 | - $count = 0; |
|
| 238 | - $question_options = $question->options(); |
|
| 239 | - if (! empty($question_options)) { |
|
| 240 | - foreach ($question_options as $option_id => $option) { |
|
| 241 | - $disabled_attr = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 242 | - ?> |
|
| 237 | + $count = 0; |
|
| 238 | + $question_options = $question->options(); |
|
| 239 | + if (! empty($question_options)) { |
|
| 240 | + foreach ($question_options as $option_id => $option) { |
|
| 241 | + $disabled_attr = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
| 242 | + ?> |
|
| 243 | 243 | <tr class="question-option ee-options-sortable"> |
| 244 | 244 | <td class="option-value-cell"> |
| 245 | 245 | <input type="hidden" class="QSO_order" |
@@ -265,21 +265,21 @@ discard block |
||
| 265 | 265 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
| 266 | 266 | </td> |
| 267 | 267 | <?php |
| 268 | - echo EEH_Form_Fields::hidden_input( |
|
| 269 | - "question_options[{$count}][QST_ID])", |
|
| 270 | - $option->question_ID() |
|
| 271 | - ); |
|
| 272 | - echo EEH_Form_Fields::hidden_input( |
|
| 273 | - "question_options[{$count}][QSO_ID])", |
|
| 274 | - $option->ID() |
|
| 275 | - ); |
|
| 276 | - $count++; |
|
| 277 | - ?> |
|
| 268 | + echo EEH_Form_Fields::hidden_input( |
|
| 269 | + "question_options[{$count}][QST_ID])", |
|
| 270 | + $option->question_ID() |
|
| 271 | + ); |
|
| 272 | + echo EEH_Form_Fields::hidden_input( |
|
| 273 | + "question_options[{$count}][QSO_ID])", |
|
| 274 | + $option->ID() |
|
| 275 | + ); |
|
| 276 | + $count++; |
|
| 277 | + ?> |
|
| 278 | 278 | </tr> |
| 279 | 279 | <?php |
| 280 | - } |
|
| 281 | - } else { |
|
| 282 | - ?> |
|
| 280 | + } |
|
| 281 | + } else { |
|
| 282 | + ?> |
|
| 283 | 283 | <tr class="question-option ee-options-sortable"> |
| 284 | 284 | <td class="option-value-cell"> |
| 285 | 285 | <input type="hidden" class="QSO_order" name="question_options[0][QSO_order]" value="0"/> |
@@ -292,19 +292,19 @@ discard block |
||
| 292 | 292 | </td> |
| 293 | 293 | <td> |
| 294 | 294 | <?php |
| 295 | - echo EEH_Form_Fields::hidden_input("question_options_count", $count); |
|
| 296 | - ?> |
|
| 295 | + echo EEH_Form_Fields::hidden_input("question_options_count", $count); |
|
| 296 | + ?> |
|
| 297 | 297 | </td> |
| 298 | 298 | </tr> |
| 299 | 299 | <?php |
| 300 | - } |
|
| 301 | - ?> |
|
| 300 | + } |
|
| 301 | + ?> |
|
| 302 | 302 | <tr style="display:none"> |
| 303 | 303 | <td colspan="3"> |
| 304 | 304 | <?php echo EEH_Form_Fields::hidden_input( |
| 305 | - "question_options_count", |
|
| 306 | - $count |
|
| 307 | - ); ?></td> |
|
| 305 | + "question_options_count", |
|
| 306 | + $count |
|
| 307 | + ); ?></td> |
|
| 308 | 308 | </tr> |
| 309 | 309 | </tbody> |
| 310 | 310 | </table> |
@@ -315,16 +315,16 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | <p class="description"> |
| 317 | 317 | <?php esc_html_e( |
| 318 | - 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
| 319 | - 'event_espresso' |
|
| 320 | - ) ?> |
|
| 318 | + 'Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', |
|
| 319 | + 'event_espresso' |
|
| 320 | + ) ?> |
|
| 321 | 321 | </p> |
| 322 | 322 | <?php if ($has_answers) : ?> |
| 323 | 323 | <p class="description" style="color:#D54E21;"> |
| 324 | 324 | <?php esc_html_e( |
| 325 | - 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
| 326 | - 'event_espresso' |
|
| 327 | - ); ?> |
|
| 325 | + 'Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', |
|
| 326 | + 'event_espresso' |
|
| 327 | + ); ?> |
|
| 328 | 328 | </p> |
| 329 | 329 | |
| 330 | 330 | <?php endif; ?> |
@@ -338,35 +338,35 @@ discard block |
||
| 338 | 338 | </th> |
| 339 | 339 | <td> |
| 340 | 340 | <?php |
| 341 | - $system_required = array('fname', 'email'); |
|
| 342 | - $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 343 | - $required_on = $question->get('QST_admin_only'); |
|
| 344 | - $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 345 | - $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 346 | - $id = ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 347 | - $requiredOptions = array( |
|
| 348 | - array('text' => esc_html__('Optional', 'event_espresso'), 'id' => 0), |
|
| 349 | - array('text' => esc_html__('Required', 'event_espresso'), 'id' => 1), |
|
| 350 | - ); |
|
| 351 | - echo EEH_Form_Fields::select_input( |
|
| 352 | - 'QST_required' . $id, |
|
| 353 | - $requiredOptions, |
|
| 354 | - $question->required(), |
|
| 355 | - 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 356 | - ); |
|
| 357 | - ?> |
|
| 341 | + $system_required = array('fname', 'email'); |
|
| 342 | + $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 343 | + $required_on = $question->get('QST_admin_only'); |
|
| 344 | + $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 345 | + $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 346 | + $id = ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 347 | + $requiredOptions = array( |
|
| 348 | + array('text' => esc_html__('Optional', 'event_espresso'), 'id' => 0), |
|
| 349 | + array('text' => esc_html__('Required', 'event_espresso'), 'id' => 1), |
|
| 350 | + ); |
|
| 351 | + echo EEH_Form_Fields::select_input( |
|
| 352 | + 'QST_required' . $id, |
|
| 353 | + $requiredOptions, |
|
| 354 | + $question->required(), |
|
| 355 | + 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 356 | + ); |
|
| 357 | + ?> |
|
| 358 | 358 | <p><span id="required_toggled_on" class="description" |
| 359 | 359 | style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
| 360 | 360 | <?php esc_html_e( |
| 361 | - 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 362 | - 'event_espresso' |
|
| 363 | - ) ?> |
|
| 361 | + 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 362 | + 'event_espresso' |
|
| 363 | + ) ?> |
|
| 364 | 364 | </span></p> |
| 365 | 365 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
| 366 | 366 | <?php esc_html_e( |
| 367 | - 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 368 | - 'event_espresso' |
|
| 369 | - ) ?> |
|
| 367 | + 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 368 | + 'event_espresso' |
|
| 369 | + ) ?> |
|
| 370 | 370 | </span></p> |
| 371 | 371 | <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
| 372 | 372 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | <th> |
| 383 | 383 | <label for="QST_required_text"> |
| 384 | 384 | <?php esc_html_e( |
| 385 | - 'Required Text', |
|
| 386 | - 'event_espresso' |
|
| 387 | - ); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
| 385 | + 'Required Text', |
|
| 386 | + 'event_espresso' |
|
| 387 | + ); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
| 388 | 388 | </th> |
| 389 | 389 | <td> |
| 390 | 390 | <input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" |
@@ -393,8 +393,8 @@ discard block |
||
| 393 | 393 | </td> |
| 394 | 394 | </tr> |
| 395 | 395 | <?php |
| 396 | - do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 397 | - ?> |
|
| 396 | + do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 397 | + ?> |
|
| 398 | 398 | </tbody> |
| 399 | 399 | </table> |
| 400 | 400 | |
@@ -402,5 +402,5 @@ discard block |
||
| 402 | 402 | </div> |
| 403 | 403 | |
| 404 | 404 | <?php |
| 405 | - do_action('AHEE__questions_main_meta_box__template__after_admin_page_content', $question); |
|
| 405 | + do_action('AHEE__questions_main_meta_box__template__after_admin_page_content', $question); |
|
| 406 | 406 | ?> |
| 407 | 407 | \ No newline at end of file |