<?php
$setup = array();
$setup['title'] = "Nyhedscenter";
$setup['headline'] = "Odense Track - Administration";
$setup['keywords'] = "administration,admin";
$setup['description'] = "Odense Track Administration";

Design::header($setup, 100);
?>

<div class="page">
    <h1>Nyhedscenter</h1> <div class="pull_right"><a href="?page=newsadmin">Nyheder</a><span class="seperator"></span><a href="?page=eventadmin">Events</a></div>
    <div class="border"></div>
    <br />
    <p>Velkommen til administrations-interfacet.<br /><br /></p>

    <div class="amenu pull_right">
        <a href="?page=addnews"><button type="button" class="btn btn-success"><i class="fa fa-plus" title="Opret artikel"></i> Opret Nyhed</button></a>
    </div>


    <div class="nmin">
        <h4>Liste over nyheder</h4>


        <table cellspacing="0">
            <tr>
                <th>ID</th>
                <th>Titel</th>
                <th>Dato</th>
                <th>Indstillinger</th>
            </tr>
            <?php
            foreach (Get::NewsList() as $row) {
                ?>
                <tr>
                    <td><?php echo $row['id']; ?></td>
                    <td><?php echo $row['title']; ?></td>
                    <td><?php echo date('H:i d/m-Y', $row['time']); ?></td>
                    <td>
                        <a href="?page=editnews&id=<?php echo $row['id']; ?>"><button type="button" class="btn btn-primary"><i class="fa fa-pencil" title="Rediger artikel"></i></button></a>
                        <a href="?page=editnews&action=del&id=<?php echo $row['id']; ?>"  onclick="return confirm('Er du sikker på du vil slette denne nyhed?');"><button type="button" class="btn btn-danger"><i class="fa fa-trash" title="Slet artikel"></i></button></a>
                    </td>
                </tr>

                <?php
            }
            ?>

        </table>
    </div>
</div>

<?php
Design::footer(false);
