function forena_admin_reports in Forena Reports 7.5
Same name and namespace in other branches
- 8 forena_ui/forena.admin.inc \forena_admin_reports()
- 6.2 forena.admin.inc \forena_admin_reports()
- 7.2 forena.admin.inc \forena_admin_reports()
- 7.3 forena.admin.inc \forena_admin_reports()
- 7.4 forena.admin.inc \forena_admin_reports()
Display reports to edit for admins in the structure menu Enter description here ...
1 string reference to 'forena_admin_reports'
- forena_menu in ./
forena.module - Implementation of hook_menu.
File
- ./
forena.admin.inc, line 13
Code
function forena_admin_reports() {
global $language;
$data = array();
$output = '';
$content = drupal_get_form('forena_sync_form');
$sync_form = drupal_render($content);
$links[] = array(
'href' => 'reports/add',
'title' => 'Create New Report',
);
$output .= theme('links', array(
'links' => $links,
'attributes' => array(
'class' => 'action-links',
),
));
// Add Data tables if it exists.
$headers = array(
t('category'),
t('title'),
t('name'),
t('operation'),
);
$result = Frx::File()
->allReports();
foreach ($result as $report => $row) {
$rpt = str_replace('/', '.', $report);
if ($row->include) {
$edit = l(t('Override'), 'reports/' . $rpt . '/edit');
}
else {
$edit = l(t('Edit'), 'reports/' . $rpt . '/edit');
}
$clone = l(t('Clone'), 'reports/add/' . $rpt);
// Determine the nature of the report delete link.
if ($row->override) {
$delete = l(t('Revert'), 'reports/' . $rpt . '/delete', array(
'query' => array(
'destination' => 'admin/structure/forena',
),
));
}
else {
if (!$row->include) {
$delete = l(t('Delete'), 'reports/' . $rpt . '/delete', array(
'query' => array(
'destination' => 'admin/structure/forena',
),
));
}
else {
$delete = '';
}
}
$title = l(t($row->cache['title']), 'reports/' . $rpt);
$data[] = array(
$row->cache['category'],
$title,
$report,
$edit . ' ' . $clone . ' ' . $delete,
);
}
$output .= '<div id="forena-reports-list">';
$output .= theme('forena_data_table', array(
'header' => $headers,
'rows' => $data,
));
$output .= '</div>';
$output .= $sync_form;
return $output;
}