You are here

function _systeminfo_admin_overview_drupal_content in System Information 7.3

Same name and namespace in other branches
  1. 6.3 systeminfo.admin.inc \_systeminfo_admin_overview_drupal_content()
1 call to _systeminfo_admin_overview_drupal_content()
systeminfo_admin_overview in ./systeminfo.admin.inc
Menu callback; displays the overview page.

File

./systeminfo.admin.inc, line 75
Admin page callbacks for the systeminfo module.

Code

function _systeminfo_admin_overview_drupal_content() {
  $rows = array();
  $rows[] = array(
    t('Total'),
    format_plural(db_query('SELECT COUNT(nid) FROM {node}')
      ->fetchField(), '1 node', '@count nodes'),
  );
  $node_types = array();
  $result = db_query('SELECT n.type, nt.name, COUNT(n.nid) AS count FROM {node} n LEFT JOIN {node_type} nt ON n.type = nt.type GROUP BY n.type');
  foreach ($result as $record) {
    if (!$record->name) {
      $record->name = $record->type;
    }
    $node_types[$record->name] = $record;
  }
  ksort($node_types);
  foreach ($node_types as $node_type) {
    $rows[] = array(
      array(
        'data' => check_plain($node_type->name),
        'class' => 'text1',
      ),
      format_plural($node_type->count, '1 node', '@count nodes'),
    );
  }
  return theme('table', array(
    'header' => array(),
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'systeminfo',
        'systeminfo-width50',
      ),
    ),
  ));
}