Changeset 1798 for trunk/bp-xprofile/bp-xprofile-admin.php
- Timestamp:
- 09/06/2009 01:07:21 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-xprofile/bp-xprofile-admin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-admin.php
r1643 r1798 42 42 <p><?php _e('NOTE: Any fields in the first group will appear on the signup page.', 'buddypress'); ?></p> 43 43 44 <?php 45 if ( $message != '' ) { 46 $type = ( $type == 'error' ) ? 'error' : 'updated'; 47 ?> 48 <div id="message" class="<?php echo $type; ?> fade"> 49 <p><?php echo wp_specialchars( $message ); ?></p> 50 </div> 51 <?php } 52 53 if ( $groups ) { ?> 54 <?php 55 for ( $i = 0; $i < count($groups); $i++ ) { // TODO: foreach 44 <form action="" id="profile-field-form" method="post"> 45 46 <?php wp_nonce_field( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); ?> 47 48 <?php 49 if ( $message != '' ) { 50 $type = ( $type == 'error' ) ? 'error' : 'updated'; 56 51 ?> 57 <p> 58 <table id="group_<?php echo $groups[$i]->id;?>" class="widefat"> 59 <thead> 60 <tr class="nodrag"> 61 <th scope="col" colspan="<?php if ( $groups[$i]->can_delete ) { ?>3<?php } else { ?>5<?php } ?>"><?php echo $groups[$i]->name; ?></th> 62 <?php if ( $groups[$i]->can_delete ) { ?> 63 <th scope="col"><a class="edit" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=edit_group&group_id=<?php echo $groups[$i]->id; ?>"><?php _e( 'Edit', 'buddypress' ) ?></a></th> 64 <th scope="col"><a class="delete" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=delete_group&group_id=<?php echo $groups[$i]->id; ?>"><?php _e( 'Delete', 'buddypress' ) ?></a></th> 52 <div id="message" class="<?php echo $type; ?> fade"> 53 <p><?php echo wp_specialchars( attribute_escape( $message ) ); ?></p> 54 </div> 55 <?php } 56 57 if ( $groups ) { ?> 58 <?php 59 for ( $i = 0; $i < count($groups); $i++ ) { // TODO: foreach 60 ?> 61 <p> 62 <table id="group_<?php echo $groups[$i]->id;?>" class="widefat field-group"> 63 <thead> 64 <tr> 65 <th scope="col"> </th> 66 <th scope="col" colspan="<?php if ( $groups[$i]->can_delete ) { ?>3<?php } else { ?>5<?php } ?>"><?php echo attribute_escape( $groups[$i]->name ); ?></th> 67 <?php if ( $groups[$i]->can_delete ) { ?> 68 <th scope="col"><a class="edit" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=edit_group&group_id=<?php echo attribute_escape( $groups[$i]->id ); ?>"><?php _e( 'Edit', 'buddypress' ) ?></a></th> 69 <th scope="col"><a class="delete" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=delete_group&group_id=<?php echo attribute_escape( $groups[$i]->id ); ?>"><?php _e( 'Delete', 'buddypress' ) ?></a></th> 70 <?php } ?> 71 </tr> 72 <tr class="header"> 73 <td> </td> 74 <td><?php _e( 'Field Name', 'buddypress' ) ?></td> 75 <td width="14%"><?php _e( 'Field Type', 'buddypress' ) ?></td> 76 <td width="6%"><?php _e( 'Required?', 'buddypress' ) ?></td> 77 <td colspan="2" width="10%" style="text-align:center;"><?php _e( 'Action', 'buddypress' ) ?></td> 78 </tr> 79 </thead> 80 <tbody id="the-list"> 81 82 <?php if ( $groups[$i]->fields ) { ?> 83 84 <?php for ( $j = 0; $j < count($groups[$i]->fields); $j++ ) { ?> 85 86 <?php if ( 0 == $j % 2 ) { $class = ""; } else { $class = "alternate"; } ?> 87 <?php $field = new BP_XProfile_Field($groups[$i]->fields[$j]->id); ?> 88 <?php if ( !$field->can_delete ) { $class .= ' core'; } ?> 89 90 <tr id="field_<?php echo attribute_escape( $field->id ); ?>" class="sortable<?php if ( $class ) { echo ' ' . $class; } ?>"> 91 <td width="10"><img src="<?php echo BP_PLUGIN_URL ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' ) ?>" /></td> 92 <td><span title="<?php echo $field->desc; ?>"><?php echo attribute_escape( $field->name ); ?> <?php if(!$field->can_delete) { ?>(Core)<?php } ?></span></td> 93 <td><?php echo attribute_escape( $field->type ); ?></td> 94 <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . BP_PLUGIN_URL . '/bp-xprofile/admin/images/tick.gif" alt="' . __( 'Yes', 'buddypress' ) . '" />'; } else { ?>--<?php } ?></td> 95 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Edit', 'buddypress' ) ?></strike><?php } else { ?><a class="edit" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&group_id=<?php echo attribute_escape( $groups[$i]->id ); ?>&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=edit_field"><?php _e( 'Edit', 'buddypress' ) ?></a><?php } ?></td> 96 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Delete', 'buddypress' ) ?></strike><?php } else { ?><a class="delete" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td> 97 </tr> 98 99 <?php } ?> 100 101 <?php } else { ?> 102 103 <tr class="nodrag"> 104 <td colspan="6"><?php _e( 'There are no fields in this group.', 'buddypress' ) ?></td> 105 </tr> 106 65 107 <?php } ?> 66 </tr> 67 </thead> 68 <tbody id="the-list"> 69 <tr class="header nodrag"> 70 <td><?php _e( 'Field Name', 'buddypress' ) ?></td> 71 <td width="14%"><?php _e( 'Field Type', 'buddypress' ) ?></td> 72 <td width="6%"><?php _e( 'Required?', 'buddypress' ) ?></td> 73 <td colspan="2" width="10%" style="text-align:center;"><?php _e( 'Action', 'buddypress' ) ?></td> 74 </tr> 75 76 <?php if ( $groups[$i]->fields ) { ?> 77 <?php for ( $j = 0; $j < count($groups[$i]->fields); $j++ ) { ?> 78 <?php if ( 0 == $j % 2 ) { $class = ""; } else { $class = "alternate"; } ?> 79 <?php $field = new BP_XProfile_Field($groups[$i]->fields[$j]->id); ?> 80 <?php if ( !$field->can_delete ) { $class .= ' core'; } ?> 81 82 <tr id="field_<?php echo $field->id; ?>" <?php if ( $class ) { echo 'class="' . $class . '"'; } ?>> 83 <td><span title="<?php echo $field->desc; ?>"><?php echo $field->name; ?> <?php if(!$field->can_delete) { ?>(Core)<?php } ?></span></td> 84 <td><?php echo $field->type; ?></td> 85 <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . $bp->profile->image_base . '/tick.gif" alt="' . _e( 'Yes', 'buddypress' ) . '" />'; } else { ?>--<?php } ?></td> 86 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Edit', 'buddypress' ) ?></strike><?php } else { ?><a class="edit" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&group_id=<?php echo $groups[$i]->id; ?>&field_id=<?php echo $field->id; ?>&mode=edit_field"><?php _e( 'Edit', 'buddypress' ) ?></a><?php } ?></td> 87 <td style="text-align:center;"><?php if ( !$field->can_delete ) { ?><strike><?php _e( 'Delete', 'buddypress' ) ?></strike><?php } else { ?><a class="delete" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&field_id=<?php echo $field->id; ?>&mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td> 88 </tr> 89 90 <?php } ?> 91 <?php } else { ?> 92 <tr class="nodrag"> 93 <td colspan="6"><?php _e( 'There are no fields in this group.', 'buddypress' ) ?></td> 94 </tr> 95 <?php } ?> 96 <tr class="nodrag"> 97 <td colspan="6"><a href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&group_id=<?php echo $groups[$i]->id; ?>&mode=add_field"><?php _e( 'Add New Field', 'buddypress' ) ?></a></td> 98 </tr> 99 </tbody> 100 </table> 101 </p> 102 103 <?php } /* End For */ ?> 104 105 <p> 106 <a href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=add_group"><?php _e( 'Add New Group', 'buddypress' ) ?></a> 107 </p> 108 109 <?php } else { ?> 110 <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress' ); ?></p></div> 111 <p><a href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=add_group"><?php _e( 'Add New Group', 'buddypress' ) ?></a></p> 112 <?php } ?> 108 109 </tbody> 110 111 <tfoot> 112 113 <tr class="nodrag"> 114 <td colspan="6"><a href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&group_id=<?php echo attribute_escape( $groups[$i]->id ); ?>&mode=add_field"><?php _e( 'Add New Field', 'buddypress' ) ?></a></td> 115 </tr> 116 117 </tfoot> 118 119 </table> 120 </p> 121 122 <?php } /* End For */ ?> 123 124 <p> 125 <a class="button" href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ) ?></a> 126 </p> 127 128 <?php } else { ?> 129 <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress' ); ?></p></div> 130 <p><a href="admin.php?page=<?php echo BP_PLUGIN_DIR ?>/bp-xprofile.php&mode=add_group"><?php _e( 'Add New Group', 'buddypress' ) ?></a></p> 131 <?php } ?> 132 133 </form> 134 113 135 </div> 114 136 <?php … … 255 277 xprofile_admin($message, $type); 256 278 } 279 280 function xprofile_ajax_reorder_fields() { 281 global $bp; 282 283 /* Check the nonce */ 284 check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); 285 286 if ( empty( $_POST['field_order'] ) ) 287 return false; 288 289 parse_str($_POST['field_order'], $order ); 290 291 foreach ( (array) $order['field'] as $position => $field_id ) { 292 xprofile_update_field_position( (int) $field_id, (int) $position ); 293 } 294 } 295 add_action( 'wp_ajax_xprofile_reorder_fields', 'xprofile_ajax_reorder_fields' );
Note: See TracChangeset
for help on using the changeset viewer.