<?php session_start(); ?>
<div class="eventbox-top">
    <span class="eventbox-event-title <?php
    $icon_color = 'icon-black"';
    if ($_POST["tclr"][0] == '1')
    {
        $icon_color = 'icon-white"';
    }
    echo $icon_color;
?>
><?php echo strip_tags($_POST['title']); ?></span>
    <div class="icon-bar">
<?php
    if (isset($_SESSION['logged_in']))
    {
        $own_event = $_POST['user_id'] == $_SESSION['user_id'];
        $moderator = $_SESSION['privilege_id'] < 3;

        if ($moderator && $_POST['status_id'] == 3)
        {
?>
            <div class="icon-content" onclick="approveEvent('<?php echo $_POST['event_id']; ?>')">
                <span class="icon icon-18 <?php echo $icon_color; ?>" data-icon="done"></span>
            </div>
<?php
        }

        if ($moderator || $own_event)
        {
?>
            <div class="icon-content" <?php echo "onclick='editEventBox(\"{$_POST['event_id']}\");'>"; ?>
                <span class="icon icon-18 <?php echo $icon_color; ?> data-icon="build"></span>
            </div>
            <div class="icon-content" <?php echo "onclick='deleteEvent(\"{$_POST['event_id']}\");'>"; ?>
                <span class="icon icon-18 <?php echo $icon_color; ?> data-icon="delete"></span>
            </div>
<?php
        }
    }
?>

        <div class="icon-content" onclick="closeOpacityBox('.eventInfo')">
            <span class="icon icon-18 <?php echo $icon_color; ?>" data-icon="close"></span>
        </div>
    </div>
</div>
<div class="eventbox-bottom">
<?php
    if ($_POST['status_id'] != 2)
    {
?>
    <div class="eventbox-bottom-content">
        <span class="icon icon-18" data-icon="warning"></span>
        <div class="eventbox-content-inner">
            Not yet approved.
        </div>
    </div>
<?php
    }
?>
    <div class="eventbox-bottom-content">
        <span class="icon icon-18" data-icon="schedule"></span>
        <div class="eventbox-content-inner">
<?php
    if (array_key_exists('all_day', $_POST) && $_POST['all_day'])
    {
        $pieces = explode(', ', $_POST['start_date_disp']);
        $start_date = $pieces[0];
        echo "<span class='bold'>{$start_date}</span>";
    } else {
        $pieces = explode(', ', $_POST['start_date_disp']);
        $start_date = $pieces[0];
        $start_time = $pieces[1];
        $end_pieces = explode(', ', $_POST['end_date_disp']);
        $end_date = $end_pieces[0];
        $end_time = $end_pieces[1];

        if ($end_date != $start_date)
        {
            echo "<span class='bold'>{$start_date} – {$end_date}</span><br/>";
        } else {
            echo "<span class='bold'>{$start_date}</span><br/>";
        }

        echo "<span class='eventbox-event-time'>{$start_time} – {$end_time}</span>";
    }
?>
        </div>
    </div>
<?php
    if ($_POST['labels'])
    {
?>
    <div class="eventbox-bottom-content">
        <span class="icon icon-18" data-icon="label_outline"></span>
        <div class="eventbox-content-inner">
            <?php print_r($_POST['labels']); ?>
        </div>
    </div>
<?php
    }
?>
    <div class="eventbox-bottom-content">
        <span class="icon icon-18" data-icon="person"></span>
        <div class="eventbox-content-inner">
            <?php echo $_POST['username']; ?>
        </div>
    </div>
<?php
    if ($_POST['event_text'])
    {
?>
    <div class="eventbox-bottom-content">
        <span class="icon icon-18" data-icon="message"></span>
        <div class="eventbox-content-inner evbox-description">
            <p><?php echo $_POST['event_text']; ?></p>
        </div>
    </div>
<?php } ?>
</div>
