From 2954514b4c2841db9e9088b911131bad265e9cca Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 30 Sep 2008 00:05:22 +0000 Subject: [PATCH] ENHANCEMENT #2172: Added counts to comment admin submenu items git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63327 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CommentAdmin.php | 21 +++++++++++++++++++++ templates/Includes/CommentAdmin_SiteTree.ss | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/code/CommentAdmin.php b/code/CommentAdmin.php index f8061c7e..24a1a0bb 100644 --- a/code/CommentAdmin.php +++ b/code/CommentAdmin.php @@ -260,6 +260,27 @@ JS; statusMessage("Accepted $numComments comments."); JS; } + + /** + * Return the number of moderated comments + */ + function NumModerated() { + return DB::query("SELECT COUNT(*) FROM PageComment WHERE !IsSpam AND !NeedsModeration")->value(); + } + + /** + * Return the number of unmoderated comments + */ + function NumUnmoderated() { + return DB::query("SELECT COUNT(*) FROM PageComment WHERE !IsSpam AND NeedsModeration")->value(); + } + + /** + * Return the number of comments marked as spam + */ + function NumSpam() { + return DB::query("SELECT COUNT(*) FROM PageComment WHERE IsSpam")->value(); + } } ?> diff --git a/templates/Includes/CommentAdmin_SiteTree.ss b/templates/Includes/CommentAdmin_SiteTree.ss index 66ff19fc..4b0cef1e 100644 --- a/templates/Includes/CommentAdmin_SiteTree.ss +++ b/templates/Includes/CommentAdmin_SiteTree.ss @@ -2,13 +2,13 @@
  • <% _t('COMMENTS', 'Comments') %>