You are here

function forena_admin_reports in Forena Reports 6.2

Same name and namespace in other branches
  1. 8 forena_ui/forena.admin.inc \forena_admin_reports()
  2. 7.5 forena.admin.inc \forena_admin_reports()
  3. 7.2 forena.admin.inc \forena_admin_reports()
  4. 7.3 forena.admin.inc \forena_admin_reports()
  5. 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();
  $links[] = array(
    'href' => 'reports/add',
    'title' => 'Create New Report',
  );
  $output = theme_links($links, array(
    'class' => 'action-links',
  ));
  $headers = array(
    t('title'),
    t('name'),
    t('category'),
    t('operation'),
  );
  $result = db_query("SELECT * FROM {forena_reports} where language='%s' ORDER BY category,title", $language->language);
  while ($row = db_fetch_object($result)) {
    $rpt = str_replace('/', '.', $row->report_name);
    $edit = l('Edit', 'reports/' . $rpt . '/edit');
    $clone = l('Clone', 'reports/add/' . $rpt);
    $delete = l('Delete', 'reports/' . $rpt . '/delete', array(
      'query' => array(
        'destination' => 'admin/build/reports',
      ),
    ));
    $title = l($row->title, 'reports/' . $rpt);
    $data[] = array(
      $title,
      $row->report_name,
      $row->category,
      $edit . ' ' . $clone . ' ' . $delete,
    );
  }
  $output .= theme_table($headers, $data);
  return $output;
}