You are here

function forena_get_categories in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 forena_ui/forena.admin.inc \forena_get_categories()
  2. 6.2 forena.admin.inc \forena_get_categories()
  3. 6 forena.admin.inc \forena_get_categories()
  4. 7 forena.admin.inc \forena_get_categories()
  5. 7.2 forena.admin.inc \forena_get_categories()
  6. 7.3 forena.admin.inc \forena_get_categories()
  7. 7.4 forena.admin.inc \forena_get_categories()

Auto complete function for categories Checks access for security as well.

Parameters

$string = string to be matched against categories:

Return value

An array containing all matching categories

1 call to forena_get_categories()
forena_categories_autocomplete in ./forena.module
Auto complete for categories

File

./forena.admin.inc, line 891

Code

function forena_get_categories($string = '') {
  $data = Frx::File()
    ->reportsByCategory();
  if ($string) {
    $categories = array();
    foreach (array_keys($data) as $cat) {
      if (strpos(strtolower($cat), strtolower(trim($string))) === 0) {
        $categories[] = $cat;
      }
    }
  }
  else {
    $categories = array_keys($data);
  }
  $categories = array_combine($categories, $categories);
  return $categories;
}