Refactor: delete import csv
This commit is contained in:
@@ -36,24 +36,6 @@ function statpress_add_admin_menu() {
|
||||
'statpress_add_new_page' // Funkcja renderująca stronę dodawania
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
'statpress-dashboard',
|
||||
'Typy Wydarzeń',
|
||||
'Typy wydarzeń',
|
||||
'manage_options',
|
||||
'statpress-event-types',
|
||||
'statpress_event_types_page'
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
'statpress-dashboard',
|
||||
'Sprzęt',
|
||||
'Sprzęt',
|
||||
'manage_options',
|
||||
'statpress-equipment',
|
||||
'statpress_equipment_page'
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
'statpress-dashboard',
|
||||
'Cele',
|
||||
@@ -63,10 +45,6 @@ function statpress_add_admin_menu() {
|
||||
'statpress_goals_page'
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
null, 'Dziennik Serwisowy', 'Dziennik Serwisowy', 'manage_options', 'statpress-equipment-details', 'statpress_equipment_details_page'
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
null, // Ukryta strona, nie pojawia się w menu
|
||||
'Szczegóły Treningu', // Tytuł strony
|
||||
@@ -103,15 +81,6 @@ function statpress_add_admin_menu() {
|
||||
'statpress_infographic_page' // Funkcja renderująca
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
'statpress-dashboard', // Slug rodzica
|
||||
'Import CSV', // Tytuł strony
|
||||
'Import CSV', // Tytuł w podmenu
|
||||
'manage_options', // Wymagane uprawnienia
|
||||
'statpress-import-csv', // Slug podmenu
|
||||
'statpress_import_csv_page' // Funkcja renderująca
|
||||
);
|
||||
|
||||
$statpress_plugin_hooks[] = add_submenu_page(
|
||||
'statpress-dashboard', // Slug rodzica
|
||||
'Ustawienia', // Tytuł strony
|
||||
|
||||
@@ -91,8 +91,7 @@ function statpress_equipment_page() {
|
||||
eq.status ASC, eq.name ASC"
|
||||
);
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>Zarządzaj Sprzętem</h1>
|
||||
<div class="statpress-tab-wrapper">
|
||||
<?php if ( ! empty( $message ) ) : ?>
|
||||
<div class="notice <?php echo esc_attr( $notice_class ); ?> is-dismissible"><p><?php echo esc_html( $message ); ?></p></div>
|
||||
<?php endif; ?>
|
||||
@@ -124,7 +123,7 @@ function statpress_equipment_page() {
|
||||
<tbody>
|
||||
<?php foreach ( $equipment_list as $item ) : ?>
|
||||
<?php
|
||||
$details_url = admin_url( 'admin.php?page=statpress-equipment-details&id=' . $item->id );
|
||||
$details_url = admin_url( 'admin.php?page=statpress-settings&tab=equipment_details&id=' . $item->id );
|
||||
?>
|
||||
<tr>
|
||||
<td><strong><a href="<?php echo esc_url( $details_url ); ?>"><?php echo esc_html( $item->name ); ?></a></strong><br><small><?php echo esc_html( $item->type ); ?></small></td>
|
||||
@@ -215,9 +214,8 @@ function statpress_equipment_details_page() {
|
||||
$log_types = array( 'Naprawa', 'Zakup części', 'Przegląd', 'Modyfikacja', 'Inne' );
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>Dziennik serwisowy: <?php echo esc_html( $equipment->name ); ?></h1>
|
||||
<p><a href="<?php echo esc_url( admin_url( 'admin.php?page=statpress-equipment' ) ); ?>">← Powrót do listy sprzętu</a></p>
|
||||
<div class="statpress-tab-wrapper">
|
||||
<p><a href="<?php echo esc_url( admin_url( 'admin.php?page=statpress-settings&tab=equipment' ) ); ?>" class="button">← Powrót do listy sprzętu</a></p>
|
||||
|
||||
<?php if ( ! empty( $message ) ) : ?>
|
||||
<div class="notice <?php echo esc_attr( $notice_class ); ?> is-dismissible"><p><?php echo esc_html( $message ); ?></p></div>
|
||||
|
||||
@@ -47,8 +47,7 @@ function statpress_event_types_page() {
|
||||
|
||||
$event_types = $wpdb->get_results( "SELECT * FROM $table_event_types ORDER BY name ASC" );
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>Typy Wydarzeń</h1>
|
||||
<div class="statpress-tab-wrapper">
|
||||
<?php if ( ! empty( $message ) ) : ?>
|
||||
<div class="notice <?php echo esc_attr( $notice_class ); ?> is-dismissible"><p><?php echo esc_html( $message ); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -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