function theme_module_grants_monitor_nodes_summary in Module Grants 6.4
Same name and namespace in other branches
- 6.3 module_grants_monitor/module_grants_monitor.pages.inc \theme_module_grants_monitor_nodes_summary()
Theme the passed-in nodes as a table.
Uses the following subthemes: o 'table_nodes', falling back to theme.inc/theme_table() if not defined o 'username', i.e. theme.inc/theme_username()
Parameters
$nodes: Array of nodes to display.
Return value
Themed table HTML or a paragraph saying 'No content found.' if the supplied array is empty.
1 theme call to theme_module_grants_monitor_nodes_summary()
- module_grants_monitor_accessible_content_summary in module_grants_monitor/
module_grants_monitor.pages.inc - Return as a themed table a content summary of the site filtered by the access rights of the logged-in user.
File
- module_grants_monitor/
module_grants_monitor.pages.inc, line 49 - Rendering of the accessible content summary page and tabs
Code
function theme_module_grants_monitor_nodes_summary($nodes) {
$css_path = drupal_get_path('module', 'module_grants_monitor') . '/module_grants_monitor.css';
drupal_add_css($css_path, 'module', 'all', FALSE);
if (!empty($nodes)) {
// Note the specification of fields doesn't seem to work properly
// See theme.inc/theme_table(), which uses tablesort.inc/tablesort_header()
$header = array(
array(
'data' => t('Title'),
'field' => 'r.title',
),
array(
'data' => t('Type'),
'field' => 'n.type',
),
array(
'data' => t('Creator'),
'field' => 'n.uid',
),
array(
'data' => t('Last updated'),
'field' => 'timestamp',
'sort' => 'desc',
),
array(
'data' => t('By'),
'field' => 'r.uid',
),
array(
'data' => t('Published?'),
'field' => 'status',
),
);
$show_taxonomy_terms = module_exists('taxonomy') && count(taxonomy_get_vocabularies()) > 0 && variable_get("show_taxonomy_terms", TRUE);
$show_workflow_state = module_exists('workflow');
if ($show_taxonomy_terms) {
$header[] = array(
'data' => t('Term'),
'field' => 'term',
);
}
if ($show_workflow_state) {
$header[] = array(
'data' => t('Workflow state'),
'field' => 'ws.state',
);
}
$rows = array();
foreach ($nodes as $node) {
$row = array(
l($node->title, 'node/' . $node->nid),
check_plain(node_get_types('name', $node)),
theme('username', user_load(array(
'uid' => $node->creator_uid,
))),
format_date($node->timestamp),
theme('username', user_load(array(
'uid' => $node->uid,
))),
$node->status ? t('Yes') : t('No'),
);
if ($show_taxonomy_terms) {
$row[] = empty($node->term) ? '' : check_plain($node->term);
}
if ($show_workflow_state) {
$row[] = empty($node->state) ? t('No state') : check_plain($node->state);
}
$rows[] = $row;
}
$attributes = array(
'class' => 'table-nodes',
);
return theme(array(
'table_nodes',
'table',
), $header, $rows, $attributes, $caption = NULL);
}
return '<p>' . t('No content found.') . '</p>';
}