Subversion Repositories taios

Rev

Rev 190 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Manage All Blog Posts', '../');
$page->drawHeader();
$page->drawMiddle();

$page->checkLoggedIn();

if ($page->isUserAdmin($page->getLoggedInUser()))
{
    write('<p class="bold">Use this to manage all the blog posts on the Tim32 Website.</p><br />');
   
    write('<table>');
    write('<tr>');
    write('<td class="bold">ID</td>');
    write('<td class="bold">Parent</td>');
    write('<td class="bold">Author</td>');
    write('<td class="bold">Title</td>');
    write('<td class="bold">Content</td>');
    write('<td class="bold">Date Posted</td>');
    write('<td class="bold">Category</td>');
    write('<td class="bold">Spam</td>');
    write('</tr>');

    $ids = $page->findIDs('BlogPosts', 'ORDER BY DatePosted DESC');
    for ($i = 0; $i < count($ids); $i++)
    {
        $id_str = $ids[$i];
        if (!empty($id_str))
        {
            $post = $page->getBlogPost($id_str);
            write('<tr>');
            write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
            if ($post->parent == -1)
            {
                write('<td style="color: #444444;">No Parent</td>');
            }
            else
            {
                write('<td>' . $post->parent->title . '</td>');
            }
            write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
            write('<td>' . $post->title . '</td>');
            write('<td>' . str_replace("\n", '<br />', $post->content) . '</td>');
            write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>');
            write('<td>' . $post->category . '</td>');
            write('<td>' . $post->spam . '</td>');
            write('</tr>');
        }
    }
   
    write('</table>');
}
else
{
    $page->drawError('You do not have permission to access this page.');
}

$page->drawFooter();

?>