function espresso_seating_chart_clear_booking() { seating_chart::clear_booking(); }
function output_event_seating_chart() { global $wpdb; $seating_chart_event = NULL; seating_chart::clear_booking(); if (isset($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id']) || isset($_REQUEST['seating_chart_id']) && is_numeric($_REQUEST['seating_chart_id'])) { $event_id = isset($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id']) ? $_REQUEST['event_id'] : 0; $seating_chart_id = isset($_REQUEST['seating_chart_id']) && is_numeric($_REQUEST['seating_chart_id']) ? $_REQUEST['seating_chart_id'] : 0; if ($event_id > 0) { $seating_chart_event = $wpdb->get_row("select * from " . EVENTS_SEATING_CHART_EVENT_TABLE . " where event_id = {$event_id} "); $seating_chart_id = $seating_chart_event->seating_chart_id; } if ($seating_chart_id > 0) { $venue = NULL; if ($event_id > 0) { $venue = $wpdb->get_results("select v.* from " . EVENTS_VENUE_TABLE . " v inner join " . EVENTS_VENUE_REL_TABLE . " vr on v.id = vr.venue_id where vr.event_id = {$event_id} "); } echo "<h2>" . (is_array($venue) && count($venue) > 0 ? $venue[0]->name : __('Choose a Seat', 'event_espresso')) . "</h2>"; echo "<div id='ee_s_layout'>"; #$seating_chart_id = $seating_chart_event->seating_chart_id; $levels = seating_chart::get_level_list($seating_chart_id); $sections_ar = seating_chart::get_section_ar_list($seating_chart_id); $rows_ar = seating_chart::get_row_ar_list($seating_chart_id); $seats_ar = array(); $seats_ar['asc'] = seating_chart::get_seat_ar_list($seating_chart_id, 'asc'); $seats_ar['desc'] = seating_chart::get_seat_ar_list($seating_chart_id, 'desc'); foreach ($levels as $level) { ?> <div id="ee_s_level_<?php echo str_replace(" ", "_", $level->level); ?> " class="ee_s_level"> <h4 class="level_head"><strong><?php _e('Level:', 'event_espresso'); ?> </strong> <?php echo $level->level; ?> </h4> <div class="ee_s_clear"> </div> <?php $sections = isset($sections_ar[$level->level]) ? $sections_ar[$level->level] : array(); //echo "<pre>".print_r($sections,true)."</pre>"; foreach ($sections as $section) { $alignment = seating_chart::get_section_alignment($seating_chart_id, $level->level, $section->section); $section->section_title = __('Section:', 'event_espresso'); $section->section_name = $section->section; ?> <div id="ee_s_section_<?php echo str_replace(" ", "_", $section->section); ?> " class="ee_s_section" style="float:<?php echo $alignment; ?> ;"> <h5 class="section_head" style="min-width:<?php echo strlen($section->section) * 8; ?> px;"><strong><?php echo $section->section_title; ?> </strong> <?php echo $section->section_name; ?> </h5> <?php $rows = isset($rows_ar[$level->level][$section->section]) ? $rows_ar[$level->level][$section->section] : array(); //$wpdb->get_results("select distinct row from " . EVENTS_SEATING_CHART_SEAT_TABLE . " where seating_chart_id = {$seating_chart_event->seating_chart_id} and level = '{$level->level}' and section = '{$section->section}' order by row "); foreach ($rows as $row) { $alignment = seating_chart::get_section_alignment($seating_chart_id, $level->level, $section->section); $sort_order = seating_chart::get_section_sort_order($seating_chart_id, $level->level, $section->section); ?> <div id="ee_s_row_<?php echo str_replace(" ", "_", $row->row); ?> " class="ee_s_row" style="clear: both;"> <?php $seats = $seats_ar[$sort_order][$level->level][$section->section][$row->row]; foreach ($seats as $seat) { $ee_seat_availability_class = ""; $ee_seat_placeholder = ""; $ee_seat_reserved = ""; $price = 0; if (function_exists('espresso_members_version') && is_user_logged_in()) { $price = $seat->member_price; } else { $price = $seat->price; } $check = seating_chart::check_seat_available($event_id, $seat->id); if ($check == 0) { $ee_seat_availability_class = 'ee_s_available'; } else { $ee_seat_availability_class = 'ee_s_unavailable'; } if (strtolower($seat->custom_tag) == "placeholder") { $ee_seat_placeholder = "_placeholder"; $ee_seat_availability_class = "placeholder"; } if (strtolower($seat->custom_tag) == "reserved") { $ee_seat_reserved = "_reserved"; $ee_seat_availability_class = "ee_s_unavailable"; } ?> <div id="ee_s_seat_<?php echo $seat->id; ?> " class="ee_s_seat<?php echo $ee_seat_placeholder . $ee_seat_reserved; ?> <?php echo $ee_seat_availability_class; ?> " event_id="<?php echo $event_id; ?> " seat_id="<?php echo $seat->id; ?> " seat="<?php echo $seat->seat; ?> " price="<?php echo $price; ?> " row="<?php echo $row->row; ?> " section="<?php echo $section->section; ?> " level="<?php echo $level->level; ?> " > <span style="display:none;" class="ee_s_custom_tag"><?php echo $seat->custom_tag; ?> </span> <span style="display:none;" class="ee_s_description"><?php echo $seat->description; ?> </span> </div> <?php } ?> </div> <?php } ?> </div> <?php } ?> <div class="ee_s_clear"> </div> </div> <?php } echo "</div>"; } } }