This question has been answered by BobRay. See the first response.
[[TemplateReport]]
<?php
/* TemplateReport snippet */
/* TemplateReport snippet */
$templates = $modx->getCollection('modTemplate');
$output = '<h3>Template Report</h3>';
$output .= "\n<ul>";
$published = array('published' => '1');
$unpublished = array('published' => '0');
foreach ($templates as $template) {
$id = $template->get('id');
$name = $template->get('templatename');
$c1 = $modx->newQuery('modResource');
$c1->where(array(
'published' => '1',
'template' => $id,
));
$numPublished = $modx->getCount('modResource', $c1);
$c2 = $modx->newQuery('modResource');
$c2->where(array(
'published' => '0',
'template' => $id,
));
$numUnpublished = $modx->getCount('modResource', $c2);
$output .= "\n" . '<li><b>' . $name . '</b>';
$output .= "\n<ul>";
$output .= "\n" . ' <li>Published resources: ' . $numPublished . '</li>';
$output .= "\n" . ' <li>Unpublished resources: ' . $numUnpublished . '</li>';
$output .= "\n</ul>";
$output .= "\n</li>";
}
$output .= "\n</ul>";
return $output;