You are here

function forena_get_user_reports in Forena Reports 7.3

Same name and namespace in other branches
  1. 8 forena.common.inc \forena_get_user_reports()
  2. 6.2 forena.common.inc \forena_get_user_reports()
  3. 6 forena.common.inc \forena_get_user_reports()
  4. 7.5 forena.common.inc \forena_get_user_reports()
  5. 7 forena.common.inc \forena_get_user_reports()
  6. 7.2 forena.common.inc \forena_get_user_reports()
  7. 7.4 forena.common.inc \forena_get_user_reports()

Form to edit parameters Extra features: In the parameters section of the report are new attributes frx:parm: @data_source = data block for the parameter to values from @data_field = specific field of the data block to recieve values from. if no field is specified then the first column is arbitrarily chosen. @type = The form element that will display the values: select, radios are supported default is textfield.

This function will evaluate each parameter, determine its type, data_source, and data_field and display those values appropriately.

2 calls to forena_get_user_reports()
forena_my_reports_block in ./forena.common.inc
Render the my reports category block
forena_user_reports in ./forena.module

File

./forena.common.inc, line 148
Common functions used throughout the project but loaded in this file to keep the module file lean.

Code

function forena_get_user_reports() {
  global $language;
  $result = db_query('SELECT * FROM {forena_reports} where hidden=0 and language=:language ORDER BY category,title asc', array(
    ':language' => $language->language,
  ));
  $reports = array();
  foreach ($result as $row) {
    $access = TRUE;
    $cache = $row->cache;
    if ($cache) {
      $cache = unserialize($cache);

      // Check each callback function to see if we have an error.
      if (@$cache['access']) {
        foreach ($cache['access'] as $callback => $args) {
          if ($callback) {
            foreach ($args as $arg) {
              $access = FALSE;
              if (function_exists($callback)) {
                $a = $callback($arg);
              }
              if ($a) {
                $access = TRUE;
              }
            }
          }
          else {
            $access = TRUE;
          }
        }
      }
    }
    if ($access) {
      $reports[$row->category][] = array(
        'title' => $row->title,
        'report_name' => $row->report_name,
      );
    }
  }
  return $reports;
}