Refactor: delete import csv
This commit is contained in:
@@ -4,70 +4,77 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
function statpress_settings_page() {
|
||||
$active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'general';
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
if ( get_transient( 'statpress_migration_reset_notice' ) ) {
|
||||
echo '<div class="notice notice-success is-dismissible"><p>Status migracji został zresetowany. Wróć do <a href="' . esc_url( admin_url( 'admin.php?page=statpress-dashboard' ) ) . '">głównego panelu</a>, aby ponownie uruchomić migrację.</p></div>';
|
||||
delete_transient( 'statpress_migration_reset_notice' );
|
||||
}
|
||||
?>
|
||||
<h1>Ustawienia Wtyczki Statystyk</h1>
|
||||
<form method="post" action="options.php">
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<a href="?page=statpress-settings&tab=general" class="nav-tab <?php echo 'general' === $active_tab ? 'nav-tab-active' : ''; ?>">Ogólne i API</a>
|
||||
<a href="?page=statpress-settings&tab=event_types" class="nav-tab <?php echo 'event_types' === $active_tab ? 'nav-tab-active' : ''; ?>">Typy wydarzeń</a>
|
||||
<a href="?page=statpress-settings&tab=equipment" class="nav-tab <?php echo in_array( $active_tab, array( 'equipment', 'equipment_details' ), true ) ? 'nav-tab-active' : ''; ?>">Sprzęt i Dziennik</a>
|
||||
</h2>
|
||||
|
||||
<div class="statpress-tab-content" style="margin-top: 20px;">
|
||||
<?php
|
||||
settings_fields( 'statpress_settings_group' );
|
||||
do_settings_sections( 'statpress_settings_page' );
|
||||
submit_button();
|
||||
if ( 'general' === $active_tab ) {
|
||||
statpress_settings_general_tab();
|
||||
} elseif ( 'event_types' === $active_tab ) {
|
||||
if ( function_exists( 'statpress_event_types_page' ) ) {
|
||||
statpress_event_types_page();
|
||||
} else {
|
||||
echo '<p>Brak funkcji zarządzania typami wydarzeń.</p>';
|
||||
}
|
||||
} elseif ( 'equipment' === $active_tab ) {
|
||||
statpress_equipment_page();
|
||||
} elseif ( 'equipment_details' === $active_tab ) {
|
||||
statpress_equipment_details_page();
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
<h2>Narzędzia deweloperskie</h2>
|
||||
<div class="postbox">
|
||||
<div class="postbox-header"><h3 class="hndle">Resetowanie migracji</h3></div>
|
||||
<div class="inside">
|
||||
<p>Jeśli migracja danych nie powiodła się, a przycisk do jej ponownego uruchomienia zniknął, możesz użyć tego narzędzia, aby zresetować status migracji. Po kliknięciu, przycisk w głównym panelu wtyczki pojawi się ponownie.</p>
|
||||
<form method="post">
|
||||
<input type="hidden" name="statpress_action" value="reset_migration"><?php wp_nonce_field( 'statpress_reset_migration_nonce', '_wpnonce' ); ?><?php submit_button( 'Zresetuj status migracji', 'delete' ); ?></form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function statpress_settings_general_tab() {
|
||||
?>
|
||||
<div class="postbox">
|
||||
<div class="postbox-header"><h2 class="hndle">Konfiguracja główna</h2></div>
|
||||
<div class="inside">
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields( 'statpress_privacy_settings' );
|
||||
do_settings_sections( 'statpress-privacy-section' );
|
||||
|
||||
settings_fields( 'statpress_api_settings' );
|
||||
do_settings_sections( 'statpress-api-section' );
|
||||
?>
|
||||
<hr>
|
||||
<?php submit_button( 'Zapisz ustawienia' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function statpress_register_settings() {
|
||||
// Define a single group and page for all settings on this form.
|
||||
$option_group = 'statpress_settings_group';
|
||||
$page_slug = 'statpress_settings_page';
|
||||
|
||||
// Register Privacy settings under the main group.
|
||||
register_setting(
|
||||
$option_group,
|
||||
'statpress_privacy_settings',
|
||||
'statpress_privacy_options',
|
||||
'statpress_sanitize_privacy_options'
|
||||
);
|
||||
|
||||
// Register API settings under the same main group.
|
||||
register_setting(
|
||||
$option_group,
|
||||
'statpress_api_options',
|
||||
'statpress_sanitize_api_options'
|
||||
);
|
||||
|
||||
// Add the Privacy section to the main page.
|
||||
add_settings_section(
|
||||
'statpress_privacy_zone_section',
|
||||
'Strefa Prywatności GPX',
|
||||
'statpress_privacy_section_callback',
|
||||
$page_slug
|
||||
'statpress-privacy-section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'statpress_privacy_latitude',
|
||||
'Szerokość geograficzna (Latitude)',
|
||||
'statpress_render_lat_field',
|
||||
$page_slug,
|
||||
'statpress-privacy-section',
|
||||
'statpress_privacy_zone_section'
|
||||
);
|
||||
|
||||
@@ -75,7 +82,7 @@ function statpress_register_settings() {
|
||||
'statpress_privacy_longitude',
|
||||
'Długość geograficzna (Longitude)',
|
||||
'statpress_render_lon_field',
|
||||
$page_slug,
|
||||
'statpress-privacy-section',
|
||||
'statpress_privacy_zone_section'
|
||||
);
|
||||
|
||||
@@ -83,24 +90,30 @@ function statpress_register_settings() {
|
||||
'statpress_privacy_radius',
|
||||
'Promień strefy (w metrach)',
|
||||
'statpress_render_radius_field',
|
||||
$page_slug,
|
||||
'statpress-privacy-section',
|
||||
'statpress_privacy_zone_section'
|
||||
);
|
||||
|
||||
// Add the API section to the same main page.
|
||||
// API Settings
|
||||
register_setting(
|
||||
'statpress_api_settings',
|
||||
'statpress_api_options',
|
||||
'statpress_sanitize_api_options'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'statpress_api_section',
|
||||
'Ustawienia API',
|
||||
'statpress_api_section_callback',
|
||||
$page_slug
|
||||
'statpress-api-section'
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'statpress_enable_api',
|
||||
'REST API',
|
||||
'statpress_render_enable_api_field',
|
||||
$page_slug,
|
||||
'statpress_api_section'
|
||||
'statpress-privacy-section',
|
||||
'statpress_privacy_zone_section'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user