Singla activity
This commit is contained in:
@@ -38,12 +38,12 @@ function statpress_view_activity_page() {
|
||||
}
|
||||
|
||||
// Funkcja pomocnicza do wyświetlania wiersza, jeśli wartość istnieje
|
||||
$render_row = function( $label, $value, $unit = '' ) {
|
||||
$render_row = function( $label, $value, $unit = '', $is_html = false ) {
|
||||
if ( ! is_null( $value ) && '' !== $value ) {
|
||||
echo '<tr>';
|
||||
echo '<th scope="row">' . esc_html( $label ) . '</th>';
|
||||
echo '<td>' . esc_html( $value ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</td>';
|
||||
echo '</tr>';
|
||||
echo '<div class="statpress-single-data-item">';
|
||||
echo '<span class="statpress-single-data-label">' . esc_html( $label ) . '</span>';
|
||||
echo '<span class="statpress-single-data-value">' . ( $is_html ? wp_kses_post( $value ) : esc_html( $value ) ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -169,46 +169,47 @@ function statpress_view_activity_page() {
|
||||
<div class="postbox" style="margin-top: 20px;">
|
||||
<div class="postbox-header"><h2 class="hndle">Podsumowanie</h2></div>
|
||||
<div class="inside">
|
||||
<div id="statpress-details-container">
|
||||
<div class="statpress-details-col">
|
||||
<h3>Główne dane</h3>
|
||||
<table class="form-table">
|
||||
<?php $render_row( 'Kategoria', $activity->category_name ); ?>
|
||||
<?php $render_row( 'Data', $activity->date ); ?>
|
||||
<?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
|
||||
<?php $render_row( 'Czas trwania', $activity->duration ); ?>
|
||||
<?php $render_row( 'Spalone kalorie', $activity->calories, 'kcal' ); ?>
|
||||
<?php $render_row( 'Typ wydarzenia', $activity->event_type_name ); ?>
|
||||
<?php $render_row( 'Sprzęt', $activity->equipment_name ); ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="statpress-details-col">
|
||||
<h3>Dane szczegółowe</h3>
|
||||
<table class="form-table">
|
||||
<?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?>
|
||||
<?php $render_row( 'Maksymalna prędkość', number_format( $activity->max_speed, 1, ',', ' ' ), 'km/h' ); ?>
|
||||
<?php $render_row( 'Średnie tętno', $activity->avg_heart_rate, 'bpm' ); ?>
|
||||
<?php $render_row( 'Maksymalne tętno', $activity->max_heart_rate, 'bpm' ); ?>
|
||||
<?php $render_row( 'Średni rytm', $activity->avg_cadence, 'rpm' ); ?>
|
||||
<?php $render_row( 'Maksymalny rytm', $activity->max_cadence, 'rpm' ); ?>
|
||||
<?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?>
|
||||
<?php $render_row( 'Suma spadków', $activity->total_elevation_loss, 'm' ); ?>
|
||||
<?php $render_row( 'Minimalna wysokość', $activity->min_altitude, 'm n.p.m.' ); ?>
|
||||
<?php $render_row( 'Maksymalna wysokość', $activity->max_altitude, 'm n.p.m.' ); ?>
|
||||
</table>
|
||||
</div>
|
||||
<h3 style="margin-top: 0; color: #202124;">Główne dane</h3>
|
||||
<div class="statpress-single-grid">
|
||||
<?php $render_row( 'Kategoria', $activity->category_name ); ?>
|
||||
<?php $render_row( 'Data', date_i18n( 'j F Y', strtotime( $activity->date ) ) ); ?>
|
||||
<?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
|
||||
<?php $render_row( 'Czas trwania', $activity->duration ); ?>
|
||||
<?php $render_row( 'Spalone kalorie', $activity->calories, 'kcal' ); ?>
|
||||
<?php $render_row( 'Typ wydarzenia', $activity->event_type_name ); ?>
|
||||
<?php $render_row( 'Sprzęt', $activity->equipment_name ); ?>
|
||||
</div>
|
||||
<hr>
|
||||
<h3>Notatki i linki</h3>
|
||||
<table class="form-table">
|
||||
<?php $render_row( 'Komentarz', nl2br( $activity->comment ) ); ?>
|
||||
<h3 style="color: #202124;">Dane szczegółowe</h3>
|
||||
<div class="statpress-single-grid">
|
||||
<?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?>
|
||||
<?php $render_row( 'Maksymalna prędkość', number_format( $activity->max_speed, 1, ',', ' ' ), 'km/h' ); ?>
|
||||
<?php $render_row( 'Średnie tętno', $activity->avg_heart_rate, 'bpm' ); ?>
|
||||
<?php $render_row( 'Maksymalne tętno', $activity->max_heart_rate, 'bpm' ); ?>
|
||||
<?php $render_row( 'Średni rytm', $activity->avg_cadence, 'rpm' ); ?>
|
||||
<?php $render_row( 'Maksymalny rytm', $activity->max_cadence, 'rpm' ); ?>
|
||||
<?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?>
|
||||
<?php $render_row( 'Suma spadków', $activity->total_elevation_loss, 'm' ); ?>
|
||||
<?php $render_row( 'Minimalna wysokość', $activity->min_altitude, 'm n.p.m.' ); ?>
|
||||
<?php $render_row( 'Maksymalna wysokość', $activity->max_altitude, 'm n.p.m.' ); ?>
|
||||
</div>
|
||||
<hr>
|
||||
<h3 style="color: #202124;">Notatki i linki</h3>
|
||||
<div class="statpress-single-grid">
|
||||
<?php $render_row( 'Komentarz', nl2br( esc_html( $activity->comment ) ), '', true ); ?>
|
||||
<?php if ( ! empty( $activity->strava_url ) ) : ?>
|
||||
<tr><th scope="row">Strava</th><td><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer">Zobacz aktywność na Strava</a></td></tr>
|
||||
<div class="statpress-single-data-item">
|
||||
<span class="statpress-single-data-label">Strava</span>
|
||||
<span class="statpress-single-data-value"><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer">Zobacz aktywność na Strava</a></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $activity->gpx_url ) ) : ?>
|
||||
<tr><th scope="row">Plik GPX</th><td><a href="<?php echo esc_url( $activity->gpx_url ); ?>" target="_blank">Pobierz plik GPX</a></td></tr>
|
||||
<div class="statpress-single-data-item">
|
||||
<span class="statpress-single-data-label">Plik GPX</span>
|
||||
<span class="statpress-single-data-value"><a href="<?php echo esc_url( $activity->gpx_url ); ?>" target="_blank">Pobierz plik GPX</a></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ( $has_gpx_data ) : ?>
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user