-
-
-
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
0 ? sprintf( _n( '%1$d day', '%1$d days', $selected_course['Days'], 'eduadmin-booking' ), $selected_course['Days'] ) . ', ' : '' ) .
+ $selected_course['StartTime'] . ' - ' . $selected_course['EndTime'];
+ }
+
+ if ( ! in_array( 'price', $hide_sections, true ) && ! empty( $prices ) ) {
?>
-
-
-
-
-
-
+
-
-
-
-
-
-
-
- get_option( 'eduadmin-currency', 'SEK' );
+ if ( 1 === count( $prices ) ) {
+ echo wp_kses_post( sprintf( '
%1$s %2$s
', current( $prices )['PriceNameDescription'], edu_get_price( current( $prices )['Price'], $selected_course['ParticipantVat'] ) ) );
+ } else {
+ foreach ( $prices as $up ) {
+ echo wp_kses_post( sprintf( '
%1$s %2$s
', $up['PriceNameDescription'], edu_get_price( $up['Price'], $selected_course['ParticipantVat'] ) ) );
+ }
+ }
+ }
?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- get_option( 'eduadmin-api-key' );
-if ( ! $api_key || empty( $api_key ) ) {
- echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+if ( ! EDU()->api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
} else {
- if ( ! empty( $_POST['edu-interest-nonce'] ) && wp_verify_nonce( $_POST['edu-interest-nonce'], 'edu-event-interest' ) && isset( $_POST['act'] ) && 'eventInquiry' === sanitize_text_field( $_POST['act'] ) ) {
- include_once 'send-event-inquiry.php';
- }
+ if ( ! $api_key || empty( $api_key ) ) {
+ echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+ } else {
+ if ( ! empty( $_POST['edu-interest-nonce'] ) && wp_verify_nonce( $_POST['edu-interest-nonce'], 'edu-event-interest' ) && isset( $_POST['act'] ) && 'eventInquiry' === sanitize_text_field( $_POST['act'] ) ) {
+ include_once 'send-event-inquiry.php';
+ }
- $course_id = $wp_query->query_vars['courseId'];
- $group_by_city = EDU()->is_checked( 'eduadmin-groupEventsByCity', false );
- $fetch_months = EDU()->get_option( 'eduadmin-monthsToFetch', 6 );
- if ( ! is_numeric( $fetch_months ) ) {
- $fetch_months = 6;
- }
- $edo = json_decode( EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ), true );
+ $course_id = $wp_query->query_vars['courseId'];
+ $group_by_city = EDU()->is_checked( 'eduadmin-groupEventsByCity', false );
+ $fetch_months = EDU()->get_option( 'eduadmin-monthsToFetch', 6 );
+ if ( ! is_numeric( $fetch_months ) ) {
+ $fetch_months = 6;
+ }
+ $edo = json_decode( EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ), true );
- $selected_course = false;
- $name = '';
- if ( $edo ) {
- $name = ( ! empty( $edo['CourseName'] ) ? $edo['CourseName'] : $edo['InternalCourseName'] );
- $selected_course = $edo;
- }
+ $selected_course = false;
+ $name = '';
+ if ( $edo ) {
+ $name = ( ! empty( $edo['CourseName'] ) ? $edo['CourseName'] : $edo['InternalCourseName'] );
+ $selected_course = $edo;
+ }
- $is_ondemand = $selected_course['OnDemand'];
+ $is_ondemand = $selected_course['OnDemand'];
- if ( $is_ondemand ) {
- $selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
- }
+ if ( $is_ondemand ) {
+ $selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
+ }
- if ( ! $selected_course ) {
- ?>
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ ?>
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
-
-
+
+ get_option( 'eduadmin-api-key' );
-
-if ( ! $api_key || empty( $api_key ) ) {
- echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+if ( ! EDU()->api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
} else {
- if ( ! empty( $_POST['edu-interest-nonce'] ) && wp_verify_nonce( $_POST['edu-interest-nonce'], 'edu-object-interest' ) && isset( $_POST['act'] ) && 'objectInquiry' === sanitize_text_field( $_POST['act'] ) ) {
- include_once 'send-object-inquiry.php';
- }
+ if ( ! $api_key || empty( $api_key ) ) {
+ echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+ } else {
+ if ( ! empty( $_POST['edu-interest-nonce'] ) && wp_verify_nonce( $_POST['edu-interest-nonce'], 'edu-object-interest' ) && isset( $_POST['act'] ) && 'objectInquiry' === sanitize_text_field( $_POST['act'] ) ) {
+ include_once 'send-object-inquiry.php';
+ }
- $course_id = $wp_query->query_vars['courseId'];
- $group_by_city = EDU()->is_checked( 'eduadmin-groupEventsByCity', false );
- $fetch_months = EDU()->get_option( 'eduadmin-monthsToFetch', 6 );
- if ( ! is_numeric( $fetch_months ) ) {
- $fetch_months = 6;
- }
+ $course_id = $wp_query->query_vars['courseId'];
+ $group_by_city = EDU()->is_checked( 'eduadmin-groupEventsByCity', false );
+ $fetch_months = EDU()->get_option( 'eduadmin-monthsToFetch', 6 );
+ if ( ! is_numeric( $fetch_months ) ) {
+ $fetch_months = 6;
+ }
- $edo = json_decode( EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ), true );
+ $edo = json_decode( EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ), true );
- $selected_course = false;
- $name = '';
- if ( $edo ) {
- $name = ( ! empty( $edo['CourseName'] ) ? $edo['CourseName'] : $edo['InternalCourseName'] );
- $selected_course = $edo;
- }
+ $selected_course = false;
+ $name = '';
+ if ( $edo ) {
+ $name = ( ! empty( $edo['CourseName'] ) ? $edo['CourseName'] : $edo['InternalCourseName'] );
+ $selected_course = $edo;
+ }
- if ( ! $selected_course ) {
- ?>
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+ ?>
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+ api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
+
+ return;
+}
+
$surl = get_home_url();
$cat = EDU()->get_option( 'eduadmin-rewriteBaseUrl', '' );
$base_url = $surl . '/' . $cat;
diff --git a/content/template/listTemplate/search-form.php b/content/template/listTemplate/search-form.php
index fc570f93..9eddb3ac 100644
--- a/content/template/listTemplate/search-form.php
+++ b/content/template/listTemplate/search-form.php
@@ -1,3 +1,9 @@
+api_connection ) {
+
+ return;
+}
+?>
+ get_option( 'eduadmin-api-key' );
-if ( ! $api_key || empty( $api_key ) ) {
- echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+if ( ! EDU()->api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
} else {
- include 'list-options.php';
- ?>
-
-
-
+ if ( ! $api_key || empty( $api_key ) ) {
+ echo 'Please complete the configuration:
EduAdmin - Api Authentication';
+ } else {
+ include 'list-options.php';
+ ?>
+
-
- query;
$api_key = EDU()->get_option( 'eduadmin-api-key' );
-if ( ! empty( EDU()->session['eduadmin-loginUser'] ) && ! empty( EDU()->session['eduadmin-loginUser']->Contact ) && ! empty( EDU()->session['eduadmin-loginUser']->Contact->PersonId ) && 0 !== EDU()->session['eduadmin-loginUser']->Contact->PersonId ) {
- if ( isset( $q['edu-login'] ) || isset( $q['edu-profile'] ) ) {
- require_once 'profile.php';
- } elseif ( isset( $q['edu-bookings'] ) ) {
- require_once 'bookings.php';
- } elseif ( isset( $q['edu-limiteddiscount'] ) ) {
- require_once 'limited-discount.php';
- } elseif ( isset( $q['edu-certificates'] ) ) {
- require_once 'certificates.php';
- } elseif ( isset( $q['edu-password'] ) ) {
- require_once 'change-password.php';
+if ( ! EDU()->api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
+} else {
+ if ( ! empty( EDU()->session['eduadmin-loginUser'] ) && ! empty( EDU()->session['eduadmin-loginUser']->Contact ) && ! empty( EDU()->session['eduadmin-loginUser']->Contact->PersonId ) && 0 !== EDU()->session['eduadmin-loginUser']->Contact->PersonId ) {
+ if ( isset( $q['edu-login'] ) || isset( $q['edu-profile'] ) ) {
+ require_once 'profile.php';
+ } elseif ( isset( $q['edu-bookings'] ) ) {
+ require_once 'bookings.php';
+ } elseif ( isset( $q['edu-limiteddiscount'] ) ) {
+ require_once 'limited-discount.php';
+ } elseif ( isset( $q['edu-certificates'] ) ) {
+ require_once 'certificates.php';
+ } elseif ( isset( $q['edu-password'] ) ) {
+ require_once 'change-password.php';
+ } else {
+ require_once 'profile.php';
+ }
} else {
- require_once 'profile.php';
+ require_once 'login-page.php';
}
-} else {
- require_once 'login-page.php';
}
$out = ob_get_clean();
diff --git a/content/template/programme/book.php b/content/template/programme/book.php
index 997b06a4..e9a21702 100644
--- a/content/template/programme/book.php
+++ b/content/template/programme/book.php
@@ -1,649 +1,654 @@
';
- foreach ( $error_list as $error ) {
- ?>
-
-
-
- ';
- } else {
- $ebi = $GLOBALS['edubookinginfo'];
- do_action( 'eduadmin-processbooking', $ebi );
- do_action( 'eduadmin-bookingcompleted' );
- }
+if ( ! EDU()->api_connection ) {
+ echo esc_html_x( 'EduAdmin Booking could not connect to the API', 'frontend', 'eduadmin-booking' );
} else {
- if ( EDU()->is_checked( 'eduadmin-useBookingFormFromApi', false ) ) {
- if ( ! empty( $programme['BookingFormUrl'] ) ) {
- ?>
-
- get_option( 'eduadmin-booking-form-javascript', '' ) ) ) ) {
+ if ( ! empty( $_POST['edu-valid-form'] ) && wp_verify_nonce( $_POST['edu-valid-form'], 'edu-booking-confirm' ) && isset( $_POST['act'] ) && 'bookProgramme' === sanitize_text_field( $_POST['act'] ) ) {
+ $error_list = apply_filters( 'edu-booking-error', array() );
+ if ( ! empty( $error_list ) ) {
+ echo '
';
+ foreach ( $error_list as $error ) {
?>
-
+
+
+
';
} else {
- echo _x( 'The booking form needs configuration in EduAdmin before this works.', 'frontend', 'eduadmin-booking' );
+ $ebi = $GLOBALS['edubookinginfo'];
+ do_action( 'eduadmin-processbooking', $ebi );
+ do_action( 'eduadmin-bookingcompleted' );
}
+ } else {
+ if ( EDU()->is_checked( 'eduadmin-useBookingFormFromApi', false ) ) {
+ if ( ! empty( $programme['BookingFormUrl'] ) ) {
+ ?>
+
+ get_option( 'eduadmin-booking-form-javascript', '' ) ) ) ) {
+ ?>
+
+ session['eduadmin-loginUser'] ) ) {
- $user = EDU()->session['eduadmin-loginUser'];
- $contact = $user->Contact;
- $customer = $user->Customer;
- }
+ $discount_percent = 0.0;
+ $participant_discount_percent = 0.0;
+ $customer_invoice_email = '';
- $no_invoice_free_events = EDU()->is_checked( 'eduadmin-noInvoiceFreeEvents', false );
+ if ( isset( EDU()->session['eduadmin-loginUser'] ) ) {
+ $user = EDU()->session['eduadmin-loginUser'];
+ $contact = $user->Contact;
+ $customer = $user->Customer;
+ }
- $first_price = current( $programme['PriceNames'] );
+ $no_invoice_free_events = EDU()->is_checked( 'eduadmin-noInvoiceFreeEvents', false );
- $show_invoice_email = isset( $attributes['hideinvoiceemailfield'] ) ? false === $attributes['hideinvoiceemailfield'] : ! EDU()->is_checked( 'eduadmin-hideInvoiceEmailField', false );
- $force_show_invoice_information = isset( $attributes['showinvoiceinformation'] ) ? false === $attributes['showinvoiceinformation'] : EDU()->is_checked( 'eduadmin-showInvoiceInformation', false );
+ $first_price = current( $programme['PriceNames'] );
- $block_edit_if_logged_in = EDU()->is_checked( 'eduadmin-blockEditIfLoggedIn', true );
- $__block = ( $block_edit_if_logged_in && isset( $contact->PersonId ) && 0 !== $contact->PersonId );
+ $show_invoice_email = isset( $attributes['hideinvoiceemailfield'] ) ? false === $attributes['hideinvoiceemailfield'] : ! EDU()->is_checked( 'eduadmin-hideInvoiceEmailField', false );
+ $force_show_invoice_information = isset( $attributes['showinvoiceinformation'] ) ? false === $attributes['showinvoiceinformation'] : EDU()->is_checked( 'eduadmin-showInvoiceInformation', false );
- $questions = EDUAPI()->REST->ProgrammeStart->BookingQuestions( $programme['ProgrammeStartId'], true );
+ $block_edit_if_logged_in = EDU()->is_checked( 'eduadmin-blockEditIfLoggedIn', true );
+ $__block = ( $block_edit_if_logged_in && isset( $contact->PersonId ) && 0 !== $contact->PersonId );
- $booking_questions = $questions['BookingQuestions'];
- $participant_questions = $questions['ParticipantQuestions'];
+ $questions = EDUAPI()->REST->ProgrammeStart->BookingQuestions( $programme['ProgrammeStartId'], true );
- ?>
-