Esempio n. 1
0
File: index.php Progetto: ssrsfs/blg
	Comment admin listing controller

	24 march 2011: cleaned up
	25 march 2011: rewrote to use DAO
	29 march 2011: now using getTotal
*/
// TODO: Consider making a separate admin page for comment sections (i.e., each URL that has a comment plugin)
// TODO: Do it by adding filters at the top
//$comments = Comment::DAOFactory();
$comments = new Model_Comment();
if (defined('COMMENTS_REQUIRE_APPROVAL')) {
    $pm->setVariable('comments_require_approval', COMMENTS_REQUIRE_APPROVAL);
    if (COMMENTS_REQUIRE_APPROVAL) {
        $comments->where('approved = 0');
        $pm->setVariable('totalpending', $comments->getTotal());
        //$comments->resetSelect();
        $comments = new Model_Comment();
    }
}
if (isset($_REQUEST['show']) && 'unapproved' == $_REQUEST['show']) {
    $comments->where('approved = 0');
}
if (isset($_REQUEST['application'])) {
    $comments->select()->where('#__page.application = ?', $_REQUEST['application']);
}
$total = $comments->getTotal();
$comments->order('datecreated DESC');
$comments->setPagination(isset($_REQUEST['page']) ? $_REQUEST['page'] : 1);
$pm->setVariable('comments', $comments);
$page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1;
Pagination::Calculate($total, 20, $page);