function forena_admin_reports in Forena Reports 8
Same name and namespace in other branches
- 6.2 forena.admin.inc \forena_admin_reports()
- 7.5 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 ...
File
- forena_ui/
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 $row) {
$rpt = str_replace('/', '.', $row->name);
if ($row->include) {
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $edit = l(t('Override'), 'reports/' . $rpt . '/edit');
}
else {
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $edit = l(t('Edit'), 'reports/' . $rpt . '/edit');
}
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $clone = l(t('Clone'), 'reports/add/' . $rpt);
// Determine the nature of the report delete link.
if ($row->override) {
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $delete = l(t('Revert'), 'reports/' . $rpt . '/delete', array('query' => array('destination' => 'admin/structure/forena')));
}
else {
if (!$row->include) {
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $delete = l(t('Delete'), 'reports/' . $rpt . '/delete', array('query' => array('destination' => 'admin/structure/forena')));
}
else {
$delete = '';
}
}
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $title = l(t($row->cache['title']), 'reports/' . $rpt);
$data[] = array(
$row->cache['category'],
$title,
$row->name,
$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;
}