<?php

/* Template Name: Events */
include_once 'guide-functions.php';
ao_set_title('Atlanta Bridal Shows, Atlanta Wedding Event, Atlanta Bridal Expos, Atlanta Wedding Trunk Shows');
get_header();
?>
			<div class="post">
				<h2>Bridal Shows and Upcoming Events</h2>
				<p>Browse upcoming Bridal Shows and events happening soon.</p>
<?php 
// get the event list
$e = new Pod('events');
$sqlwhere = "( (approved = 1) AND (date_start >= '" . date("Y-m-d") . "  00:00:00') ) ";
$e->findRecords('t.date_start ASC', -1, $sqlwhere);
if ($e->getTotalRows() > 0) {
    while ($e->fetchRecord()) {
        // get our fields from the POD
        $ae = get_eventfields($e);
        $addr = "{$ae['addr']}, {$ae['city']}, {$ae['stat']} {$ae['zipc']}";
        $nicedate = '<b>' . date("D M j, Y", strtotime($ae['dsta'])) . '</b>';
        if ($ae['dend'] != '0000-00-00 00:00:00' && $ae['dsta'] != $ae['dend']) {
            $nicedate .= ' thru <b>' . date("D M j, Y", strtotime($ae['dend'])) . '</b>';
        }
        echo <<<HEREDOC
\t\t\t<div id="event_{$ae['id']}" class="eventlist_wrap">
\t\t\t\t<div class="eventlist_content">
\t\t\t\t\t<h2 class="eventlist_name">{$ae["name"]}</h2>
\t\t\t\t\t<p class="eventlist_desc">{$ae["desc"]}</p>
\t\t\t\t\t<div class="eventlist_detail">
\t\t\t\t\t\t<div class="eventlist_detailrow">
        $cur_title = $cp->get_field('page_title');
        $cur_head = $cp->get_field('page_heading');
        $cur_desc = $cp->get_field('description');
    }
    if ($cur_cat == 'venues' && $sub_cat != '') {
        $vt = new Pod('venue_types');
        $vt->findRecords('', -1, '', "SELECT * FROM wp_pod_tbl_venue_types WHERE slug = '{$sub_cat}'");
        $total_vts = $vt->getTotalRows();
        if ($vt->fetchRecord()) {
            $sub_cat_name = $vt->get_field('name');
            $cur_title .= ' - ' . $sub_cat_name;
        }
    }
}
// set our titles before we spit out the header.
ao_set_title($cur_title);
get_header();
?>
				<div class="post">
<?php 
if ($cur_cat == 'test') {
    echo '<p>Nothing to see here... move along.</p>';
} elseif ($cur_cat == 'home') {
    ?>
						<div class="ruled"><span class="head2 oo-color-brown ruled-text-left">Atlanta Event Services</span></div>
<?php 
    $categories = new Pod('categories');
    $categories->findRecords('', 0, '', 'SELECT name, slug, short_title, description FROM wp_pod_tbl_categories WHERE hide <> 1 ORDER BY sort_order, name');
    $total_cats = $categories->getTotalRows();
    echo '<div class="guide-catcolumn">';
    $cols = 0;