function _charts_system_charts in Charts 6
Same name and namespace in other branches
- 7 charts_system/charts_system.inc \_charts_system_charts()
Chart reports page
1 string reference to '_charts_system_charts'
- charts_system_menu in charts_system/
charts_system.module - Implementation of hook_menu().
File
- charts_system/
charts_system.inc, line 12 - @author Bruno Massa http://drupal.org/user/67164 @author TJ (based on his Chart module)
Code
function _charts_system_charts($ctype) {
$output = '';
switch ($ctype) {
case 'nodes':
$output = _charts_system_generate(t('Total'), 'SELECT COUNT(*) AS count, type AS name
FROM {node}
GROUP BY type
ORDER BY type');
$output .= _charts_system_generate(t('Published'), "SELECT COUNT(*) AS count, type AS name\n FROM {node}\n WHERE status = '1'\n GROUP BY type\n ORDER BY type");
$output .= _charts_system_generate(t('Unpublished'), "SELECT COUNT(*) AS count, type AS name\n FROM {node}\n WHERE status = '0'\n GROUP BY type\n ORDER BY type");
$output .= _charts_system_node_activity();
break;
case 'users':
$output = _charts_system_generate(t('Users Per Role'), 'SELECT COUNT(*) AS count, r.name AS name
FROM {users_roles} ur
LEFT JOIN {users} u ON ur.uid = u.uid
LEFT JOIN {role} r ON r.rid = ur.rid
GROUP BY r.rid, r.name
ORDER BY r.name');
$output .= _charts_system_generate(t('Users Status'), 'SELECT COUNT(*) AS count, status AS name
FROM {users}
WHERE uid != 0
GROUP BY status
ORDER BY status', '_charts_system_user_status_label');
break;
case 'watchdog':
$output = _charts_system_generate(t('Watchdog Messages'), 'SELECT COUNT(*) AS count, type AS name
FROM {watchdog}
GROUP BY type
ORDER BY type');
$output .= _charts_system_generate(t('Message Severity'), 'SELECT COUNT(*) AS count, severity AS name
FROM {watchdog}
GROUP BY severity
ORDER BY severity', '_charts_system_watchdog_severity_label');
break;
}
return '<div id="charts-system">' . $output . '</div>';
}