function apps_app_status_report in Apps 7
@PARAM items: an array of items to display the keys of which should be the keys of the $header param or use the default. The default are severity, title, description and action. Severity is expected to be an int in (REQUIREMENT_INFO, REQUIREMENT_OK, REQUIREMENT_WARNING, REQUIREMENT_ERROR) @PARAM header: an array of header titles, the keys of which should match the keys in $items there is a default for this value
@RETURN: a render array for the status report table
1 call to apps_app_status_report()
- apps_app_config_page in ./
apps.pages.inc - Callback for app config page
File
- ./
apps.pages.inc, line 517 - The page callbacks for the Apps module.
Code
function apps_app_status_report($items, $header = NULL) {
if (!isset($header)) {
$header = array(
'severity' => 'Status',
'title' => 'Title',
'description' => 'Description',
'action' => 'Action',
);
}
$rows = array();
$severities = array(
REQUIREMENT_INFO => array(
'title' => t('Info'),
'class' => 'info',
'image' => array(
'#theme' => "image",
"#path" => "misc/message-24-info.png",
"#alt" => "Info",
),
),
REQUIREMENT_OK => array(
'title' => t('OK'),
'class' => 'ok',
'image' => array(
'#theme' => "image",
"#path" => "misc/message-24-ok.png",
"#alt" => "Ok",
),
),
REQUIREMENT_WARNING => array(
'title' => t('Warning'),
'class' => 'warning',
'image' => array(
'#theme' => "image",
"#path" => "misc/message-24-warning.png",
"#alt" => "Warning",
),
),
REQUIREMENT_ERROR => array(
'title' => t('Error'),
'class' => 'error',
'image' => array(
'#theme' => "image",
"#path" => "misc/message-24-error.png",
"#alt" => "Error",
),
),
);
foreach ($items as $item) {
$row = array();
foreach (array_keys($header) as $key) {
if (isset($item[$key])) {
if ($key == 'severity') {
$row['data'][] = render($severities[$item[$key]]['image']);
$row['class'][] = $severities[$item[$key]]['class'];
}
elseif ($key == 'action') {
$row['data'][] = theme('item_list', array(
"items" => $item[$key],
));
}
else {
$row['data'][] = $item[$key];
}
}
else {
$row['data'][] = '';
}
}
$rows[] = $row;
}
return array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
}