function systeminfo_admin_drupal_content in System Information 7.2
1 call to systeminfo_admin_drupal_content()
- systeminfo_admin_drupal in ./
systeminfo.admin.drupal.inc - Menu callback; displays Drupal page.
File
- ./
systeminfo.admin.drupal.inc, line 26 - Admin Drupal page callbacks for the systeminfo module.
Code
function systeminfo_admin_drupal_content() {
$header = array();
$header[] = t('Group');
$header[] = t('Nodes');
$node_types_active = array();
$node_types_deleted = 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) {
$node_types_active[$record->name] = $record;
}
else {
$node_types_deleted[$record->type] = $record;
}
}
ksort($node_types_active);
ksort($node_types_deleted);
$rows = array();
$rows[] = array(
t('Total'),
db_query('SELECT COUNT(nid) FROM {node}')
->fetchField(),
);
if ($node_types_active) {
$rows[] = array(
array(
'data' => t('Active content types'),
'class' => 'title1',
'colspan' => '2',
),
);
foreach ($node_types_active as $node_type) {
$rows[] = array(
array(
'data' => check_plain($node_type->name),
'class' => 'text1',
),
$node_type->count,
);
$rows[] = array(
array(
'data' => t('Published'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND status = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
$rows[] = array(
array(
'data' => t('Promoted to front page'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND promote = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
$rows[] = array(
array(
'data' => t('Sticky at top of lists'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND sticky = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
}
}
if ($node_types_deleted) {
$rows[] = array(
array(
'data' => t('Deleted content types'),
'class' => 'title1',
'colspan' => '2',
),
);
foreach ($node_types_deleted as $node_type) {
$rows[] = array(
array(
'data' => check_plain($node_type->type),
'class' => 'text1',
),
$node_type->count,
);
$rows[] = array(
array(
'data' => t('Published'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND status = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
$rows[] = array(
array(
'data' => t('Promoted to front page'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND promote = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
$rows[] = array(
array(
'data' => t('Sticky at top of lists'),
'class' => 'text2',
),
db_query('SELECT COUNT(nid) FROM {node} WHERE type = :type AND sticky = 1', array(
':type' => $node_type->type,
))
->fetchField(),
);
}
}
$output = '<h3>' . t('Content') . '</h3>';
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'class' => array(
'systeminfo',
'systeminfo_width50',
),
),
));
return $output;
}