<div class="section">
    <div class="row">
        <div class="small-8 columns">
            <h1><i class="fa fa-history"></i> Expired System Messages</h1>
        </div>
        <div class="small-4 columns right">
            <ul class="button-group radius right">
                <li><a href="<?php echo $this->link(array('messages')) ?>" class="button secondary"><i class="fa fa-arrow-left"></i> Back</a></li>
            </ul>
        </div>
    </div>
    <div class="row">
        <div class="small-12 columns">
            <?php

            if(count($this->messages->expiredSystemMessages) > 0)
            {
                echo "
                        <table width='100%'>
                            <thead>
                                <tr>
                                    <th>Post Date</th>
                                    <th>Message</th>
                                    <th>Expiration Date (EOD)</th>
                                </tr>
                            </thead>
                            <tbody>
                    ";
                foreach($this->messages->expiredSystemMessages as $message)
                {
                    $date = new DateTime();
                    $date->setTimestamp($message['expireDate']);

                    echo "

                            <tr>
                                <td>".$message['postDate']."</td>
                                <td>".$message['message']."</td>
                                <td>".$date->format('l, F jS Y')."</td>
                            </tr>

                        ";
                }
                echo "</tbody></table>";
            }
            else
            {
                echo "<div class='small-12 columns text-center'>- No expired messages -</div>";
            }

            ?>
        </div>
    </div>
    <div class="row">
        <div class="small-12 columns">
            <h1><i class="fa fa-history"></i> Expired Private Messages</h1>
        </div>
        <div class="small-12 columns">
            <?php

            if(count($this->messages->expiredPrivateMessages) > 0)
            {
                echo "
                        <table width='100%'>
                            <thead>
                                <tr>
                                    <th>Post Date</th>
                                    <th>Message</th>
                                    <th>Expiration Date (EOD)</th>
                                </tr>
                            </thead>
                            <tbody>
                    ";
                foreach($this->messages->expiredPrivateMessages as $message)
                {
                    $date = new DateTime();
                    $date->setTimestamp($message['expireDate']);

                    echo "

                            <tr>
                                <td>".$message['postDate']."</td>
                                <td>".$message['message']."</td>
                                <td>".$date->format('l, F jS Y')."</td>
                            </tr>

                        ";
                }
                echo "</tbody></table>";
            }
            else
            {
                echo "<div class='small-12 columns text-center'>- No expired messages -</div>";
            }

            ?>
        </div>
    </div>
</div>

<div id="newMessage" class="reveal-modal small" data-reveal aria-labelledby="New Message" aria-hidden="true" role="dialog">
    <h2 id="modalTitle"><i class="fa fa-plus"></i> New Message</h2>
    <?php echo $this->form; ?>
    <a class="close-reveal-modal" aria-label="Close">&#215;</a>
</div>