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
This commit is contained in:
Sam Minnee 2008-09-30 00:05:22 +00:00
parent bb3adae0bc
commit 2954514b4c
2 changed files with 24 additions and 3 deletions

View File

@ -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();
}
}
?>

View File

@ -2,13 +2,13 @@
<li id="$ID" class="Root"><a><strong><% _t('COMMENTS', 'Comments') %></strong></a>
<ul>
<li id="record-approved" <% if Section=approved %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/approved" title="<% _t('APPROVED', 'Approved') %>"><% _t('APPROVED', 'Approved') %></a>
<a href="$baseURL/admin/comments/showtable/approved" title="<% _t('APPROVED', 'Approved') %>"><% _t('APPROVED', 'Approved') %> ($NumModerated)</a>
</li>
<li id="record-unmoderated" <% if Section=unmoderated %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="<% _t('AWAITMODERATION', 'Awaiting Moderation') %>"><% _t('AWAITMODERATION', 'Awaiting Moderation') %></a>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="<% _t('AWAITMODERATION', 'Awaiting Moderation') %>"><% _t('AWAITMODERATION', 'Awaiting Moderation') %> ($NumUnmoderated)</a>
</li>
<li id="record-spam">
<a href="$baseURL/admin/comments/showtable/spam" title="<% _t('SPAM', 'Spam') %>" <% if Section=spam %>class="current"<% end_if %>><% _t('SPAM', 'Spam') %></a>
<a href="$baseURL/admin/comments/showtable/spam" title="<% _t('SPAM', 'Spam') %>" <% if Section=spam %>class="current"<% end_if %>><% _t('SPAM', 'Spam') %> ($NumSpam)</a>
</li>
</ul>
</li>