| 1 |
<div class="wrap"> |
| 2 |
|
| 3 |
<?php |
| 4 |
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general'; |
| 5 |
|
| 6 |
$is_crm_activated = erp_is_module_active( 'crm' ); |
| 7 |
$is_hrm_activated = erp_is_module_active( 'hrm' ); |
| 8 |
|
| 9 |
$erp_import_export_fields = erp_get_import_export_fields(); |
| 10 |
$keys = array_keys( $erp_import_export_fields ); |
| 11 |
|
| 12 |
$import_export_types = []; |
| 13 |
foreach ( $keys as $type ) { |
| 14 |
$import_export_types[ $type ] = __( ucwords( $type ), 'erp' ); |
| 15 |
} |
| 16 |
|
| 17 |
if ( ! $is_crm_activated ) { |
| 18 |
unset( $import_export_types['contact'] ); |
| 19 |
unset( $import_export_types['company'] ); |
| 20 |
} |
| 21 |
|
| 22 |
if ( ! $is_hrm_activated ) { |
| 23 |
unset( $import_export_types['employee'] ); |
| 24 |
} |
| 25 |
|
| 26 |
$tabs = [ |
| 27 |
'general' => __( 'General', 'erp' ), |
| 28 |
]; |
| 29 |
|
| 30 |
if ( $is_crm_activated || $is_hrm_activated ) { |
| 31 |
$tabs['import'] = __( 'Import', 'erp' ); |
| 32 |
$tabs['export'] = __( 'Export', 'erp' ); |
| 33 |
} |
| 34 |
|
| 35 |
$tabs['misc'] = __( 'Misc.', 'erp' ); |
| 36 |
$tabs = apply_filters( 'erp_tools_tabs', $tabs ); |
| 37 |
?> |
| 38 |
|
| 39 |
<h2 class="nav-tab-wrapper erp-nav-tab-wrapper"> |
| 40 |
<?php foreach ($tabs as $tab_key => $tab_label) { ?> |
| 41 |
<a class="nav-tab <?php echo ( $current_tab == $tab_key ) ? 'nav-tab-active' : ''; ?>" href="<?php echo admin_url( 'admin.php?page=erp-tools&tab=' ) . $tab_key; ?>"><?php echo $tab_label ?></a> |
| 42 |
<?php } ?> |
| 43 |
</h2> |
| 44 |
|
| 45 |
<div class="metabox-holder"> |
| 46 |
|
| 47 |
<?php |
| 48 |
switch ( $current_tab ) { |
| 49 |
case 'import': |
| 50 |
include __DIR__ . '/tools/import.php'; |
| 51 |
break; |
| 52 |
|
| 53 |
case 'export': |
| 54 |
include __DIR__ . '/tools/export.php'; |
| 55 |
break; |
| 56 |
|
| 57 |
case 'misc': |
| 58 |
include __DIR__ . '/tools/misc.php'; |
| 59 |
break; |
| 60 |
|
| 61 |
case 'general': |
| 62 |
include __DIR__ . '/tools/general.php'; |
| 63 |
break; |
| 64 |
|
| 65 |
default: |
| 66 |
do_action( 'erp_tools_page_' . $current_tab ); |
| 67 |
break; |
| 68 |
} |
| 69 |
?> |
| 70 |
|
| 71 |
</div><!-- .metabox-holder --> |
| 72 |
</div> |
| 73 |
|