'; echo '
'; echo '
'; echo '

Authentication Required

'; echo '

Please log in to view the event summary.

'; echo '

Log In

'; echo '
'; echo '
'; get_footer(); exit; } // Get the event ID from the URL parameter $event_id = isset( $_GET['event_id'] ) ? absint( $_GET['event_id'] ) : 0; // Ensure the data class is available if ( ! class_exists( 'HVAC_Event_Summary_Data' ) ) { // Attempt to include it if not loaded $class_path = plugin_dir_path( __FILE__ ) . '../includes/community/class-event-summary-data.php'; if ( file_exists( $class_path ) ) { require_once $class_path; } else { // Handle error: Class not found, cannot display summary echo "

Error: Event Summary data handler not found.

"; return; } } // Initialize the event summary data handler $summary_data_handler = new HVAC_Event_Summary_Data( $event_id ); // Check if the event is valid if ( ! $summary_data_handler->is_valid_event() ) { // Redirect to dashboard if the event doesn't exist wp_safe_redirect( home_url( '/hvac-dashboard/' ) ); exit; } // Get the event post to check ownership $event = get_post($event_id); // Check if the current user has permission to view this event // Only the post author or users with edit_posts capability can view if ($event->post_author != get_current_user_id() && !current_user_can('edit_posts')) { get_header(); echo '
'; echo '
'; echo '
You do not have permission to view this event summary.
'; echo '

Return to Dashboard

'; echo '
'; get_footer(); exit; } // Fetch all the required event data $event_details = $summary_data_handler->get_event_details(); $venue_details = $summary_data_handler->get_event_venue_details(); $organizer_details = $summary_data_handler->get_event_organizer_details(); $transactions = $summary_data_handler->get_event_transactions(); // Calculate ticket sales summary data $total_tickets = 0; $total_revenue = 0; $ticket_types = array(); // Process transactions data if ( ! empty( $transactions ) ) { foreach ( $transactions as $txn ) { $total_tickets++; if ( isset( $txn['price'] ) ) { $total_revenue += floatval( $txn['price'] ); } // Count ticket types $ticket_type = $txn['ticket_type_name'] ?? 'Unknown'; if ( isset( $ticket_types[$ticket_type] ) ) { $ticket_types[$ticket_type]['count']++; if ( isset( $txn['price'] ) ) { $ticket_types[$ticket_type]['revenue'] += floatval( $txn['price'] ); } } else { $ticket_types[$ticket_type] = array( 'count' => 1, 'revenue' => isset( $txn['price'] ) ? floatval( $txn['price'] ) : 0, ); } } } // Start the template get_header(); ?>

- Summary

Dashboard Edit Event'; } // View public event page echo 'View Public Page'; // Email attendees link if ( current_user_can( 'edit_post', $event_id ) ) { $email_url = add_query_arg( 'event_id', $event_id, home_url( '/email-attendees/' ) ); echo 'Email Attendees'; // Certificate generation link $certificate_url = add_query_arg( 'event_id', $event_id, home_url( '/generate-certificates/' ) ); echo 'Generate Certificates'; } ?>

Event Overview

Date & Time:
Status:
Cost:
Venue:
Organizer:

Event Statistics

Total Tickets

Total Revenue

$

$data ) : ?>

$

Ticket Sales & Attendees

Attendee Email Ticket Type Price Order ID Checked In Certificate
$ $event_id, 'attendee_id' => $txn['attendee_id'] ), home_url('/generate-certificates/') ); echo ' Generate'; } elseif ($certificate_status == 'Generated' || $certificate_status == 'Sent') { // If certificate exists and is active, show view/email actions echo ' View'; echo ' '; echo ' Revoke'; } ?>

No ticket sales or attendees found for this event.

Event Description