<?php

$o = '<h2>Summary of Project Resources</h2>';
$o .= $modx->getCount('modResource', array('published' => '1')) . ' Published Resources: ';
$o .= $modx->getCount('modResource', array('published' => '0')) . ' Unpublished Resources: ';
$o .= $modx->getCount('modResource', array('deleted' => '1')) . ' Deleted Resources: ';
$o .= $modx->getCount('modResource') . ' Resources Total: ';
$o .= '<h2>Summary of Project Elements</h2>';
$o .= $modx->getCount('modChunk') . ' Chunks ';
$o .= $modx->getCount('modSnippet') . ' Snippets ';
$o .= $modx->getCount('modPlugin') . ' Plugins ';
$o .= $modx->getCount('modTemplate') . ' Templates ';
$o .= $modx->getCount('modTemplateVar') . ' Template Variables ';
return $o;

Example Output:

Summary of Project Resources

152 Published Resources:
44 Unpublished Resources:
0 Deleted Resources:
196 Resources Total:

Summary of Project Elements

58 Chunks
54 Snippets
6 Plugins
9 Templates
31 Template Variables

Comments

I intentionally violated the MODX Revolution separation of presentation code from PHP code rule, as Widgets are very basic implementations. Eventually, I would like to see Widgets take on a much larger scale rivaling that of User input, and custom Dashboard interfaces dedicated to user group and user roles.

In this article