Skip to content

Commit 0117df4

Browse files
author
Chris Gårdenberg
committed
feat: Programme starts now show number of spots left (according to settings)
fixes #498
1 parent 1108669 commit 0117df4

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
026e2a4bf09a14fb3bd4ee69ccc896cf
1+
fcd74741d0b71ff97d7953720caed9f2

content/template/programme/template/detail-list.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
$surl = get_home_url();
1313
$base_url = $surl . '/programmes';
1414

15+
$spot_left_option = EDU()->get_option( 'eduadmin-spotsLeft', 'exactNumbers' );
16+
$always_few_spots = EDU()->get_option( 'eduadmin-alwaysFewSpots', '3' );
17+
$spot_settings = EDU()->get_option( 'eduadmin-spotsSettings', "1-5\n5-10\n10+" );
18+
1519
$use_eduadmin_form = EDU()->is_checked( 'eduadmin-useBookingFormFromApi' );
1620

1721
foreach ( $grouped_programmes as $group => $grouped_programme ) {
@@ -71,8 +75,10 @@
7175
echo '</div>';
7276
}
7377

78+
$spots_left = intval( $programme_start['ParticipantNumberLeft'] );
79+
7480
echo '</td>';
75-
echo '<td>' . esc_html( $programme_start['ParticipantNumberLeft'] > 0 || intval( $programme_start['MaxParticipantNumber'] ) == 0 ? _x( 'Yes', 'frontend', 'eduadmin-booking' ) : _x( 'No', 'frontend', 'eduadmin-booking' ) ) . '</td>';
81+
echo '<td>' . "<span class=\"spotsLeftInfo\">" . get_spots_left( $spots_left, intval( $programme_start['MaxParticipantNumber'] ), $spot_left_option, $spot_settings, $always_few_spots ) . "</span>\n" . '</td>';
7682
echo '<td>';
7783

7884
$priceNames = array();

0 commit comments

Comments
 (0)