Changeset 1684774
- Timestamp:
- 06/24/2017 03:23:08 PM (9 years ago)
- Location:
- redi-restaurant-reservation/branches/custom_fields_API
- Files:
-
- 2 edited
-
redi-restaurant-reservation.php (modified) (4 diffs)
-
templates/admin.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redi-restaurant-reservation/branches/custom_fields_API/redi-restaurant-reservation.php
r1623265 r1684774 460 460 $this->options[ 'customfields_save_to' ] = CustomFieldsSaveTo::API; 461 461 462 for ( $i = 1; $i != CUSTOM_FIELDS; $i++ ) {462 for ( $i = 0; $i != CUSTOM_FIELDS; $i++ ) { 463 463 $field_id = 'field_' . $i . '_id'; 464 464 $field_name = 'field_' . $i . '_name'; … … 630 630 // Get custom fields from wordpress options 631 631 $custom_fields = array(); 632 for ( $i = 1; $i != CUSTOM_FIELDS; $i ++ ) {632 for ( $i = 0; $i != CUSTOM_FIELDS; $i ++ ) { 633 633 $field_name = 'field_' . $i . '_name'; 634 634 $field_type = 'field_' . $i . '_type'; … … 1058 1058 // Get custom fields from wordpress options 1059 1059 $custom_fields = array(); 1060 for ( $i = 1; $i != CUSTOM_FIELDS; $i ++ ) {1060 for ( $i = 0; $i != CUSTOM_FIELDS; $i ++ ) { 1061 1061 $field_name = 'field_' . $i . '_name'; 1062 1062 $field_type = 'field_' . $i . '_type'; … … 1485 1485 $comment = ''; 1486 1486 $parameters = array(); 1487 for ( $i = 1; $i != CUSTOM_FIELDS; $i++ ) {1487 for ( $i = 0; $i != CUSTOM_FIELDS; $i++ ) { 1488 1488 if ( isset( $_POST[ 'field_' . $i ] ) ) { 1489 1489 -
redi-restaurant-reservation/branches/custom_fields_API/templates/admin.php
r1623265 r1684774 57 57 } 58 58 } 59 jQuery(function () {60 jQuery('#add_field').on('click', function(){61 alert(1);62 });63 });64 65 59 </script> 66 60 <?php $admin_slug = 'redi-restaurant-reservation-settings' ?> … … 401 395 </label> 402 396 </th> 397 <th> 398 399 </th> 403 400 </tr> 404 401 </thead> 405 <?php //foreach($custom_fields as $i => $custom_field):?> 406 <?php for ( $i = 1; $i != CUSTOM_FIELDS; $i++ ):402 403 <?php for ( $i = 0; $i != CUSTOM_FIELDS; $i++ ): 407 404 if ( ! isset( $custom_fields[ $i ] ) ) { 408 405 $custom_fields[ $i ] = (object) array( … … 417 414 ?> 418 415 <?php $field_id = ('field_'.$i.'_id');?> 419 <input type="hidden" id="<?php echo $field_id;?>" name="<?php echo $field_id;?>" value="<?php echo $custom_field->Id ?>" /> 416 420 417 <tr> 421 418 <td> 419 <input type="hidden" id="<?php echo $field_id;?>" name="<?php echo $field_id;?>" value="<?php echo $custom_field->Id ?>" /> 422 420 <?php $field_name=('field_'.$i.'_name'); ?> 423 421 <input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" value="<?php echo $custom_field->Name; ?>"/> … … 425 423 <td style="vertical-align: top;"> 426 424 <?php $field_type=('field_'.$i.'_type'); ?> 427 <select onchange="set_name('<?php echo $field_name; ?>',this.options[this.selectedIndex].value);" class="field_type" name="<?php echo $field_type; ?>" >425 <select onchange="set_name('<?php echo $field_name; ?>',this.options[this.selectedIndex].value);" class="field_type" name="<?php echo $field_type; ?>" id="<?php echo $field_type; ?>"> 428 426 <option value="text" <?php if ($custom_field->Type === 'text'):?>selected="selected"<?php endif?>><?php _e('Text field', 'redi-restaurant-reservation'); ?></option> 429 427 <option value="checkbox" <?php if ($custom_field->Type === 'checkbox'):?>selected="selected"<?php endif?>><?php _e('Check box', 'redi-restaurant-reservation'); ?></option> … … 435 433 <td> 436 434 <?php $field_required=('field_'.$i.'_required'); ?> 437 <input type="checkbox" name="<?php echo $field_required; ?>" <?php if ($custom_field->Required): ?>checked="checked"<?php endif?>>435 <input type="checkbox" id="<?php echo $field_required; ?>" name="<?php echo $field_required; ?>" <?php if ($custom_field->Required): ?>checked="checked"<?php endif?>> 438 436 </td> 439 437 <td> 440 438 <?php $field_message=('field_'.$i.'_message'); ?> 441 <input type="text" name="<?php echo $field_message;?>" value="<?php echo $custom_field->Message ?>" style="width:250px;"> 442 </td> 443 </tr> 444 445 <?php endfor; // endforeach; ?> 439 <input type="text" id="<?php echo $field_message;?>" name="<?php echo $field_message;?>" value="<?php echo $custom_field->Message ?>" style="width:250px;"> 440 </td> 441 <td> 442 <a onclick="jQuery('#<?php echo $field_name; ?>').val(''); jQuery('#<?php echo $field_message; ?>').val(''); jQuery('#<?php echo $field_required; ?>').attr('checked', false);">clear</a> 443 </td> 444 </tr> 445 446 <?php endfor; ?> 446 447 </table> 447 <!-- <a href="#" id="add_field" >add another field</a>-->448 448 <!-- /custom fields--> 449 449 <p class="description">
Note: See TracChangeset
for help on using the changeset viewer.