You are here

function forena_report_desc in Forena Reports 6.2

Same name and namespace in other branches
  1. 6 forena.common.inc \forena_report_desc()
  2. 7 forena.common.inc \forena_report_desc()
  3. 7.2 forena.common.inc \forena_report_desc()

Get name from argument 1 or alterntaively from a file name

Parameters

unknown_type $name:

17 calls to forena_report_desc()
forena_add_data_block_form in ./forena.admin.inc
forena_add_param_form in ./forena.admin.inc
forena_add_report_form in ./forena.admin.inc
forena_add_report_form_submit in ./forena.admin.inc
forena_add_report_form_validate in ./forena.admin.inc

... See full list

File

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

Code

function forena_report_desc(&$name = '') {
  global $language;
  $lang = $language->language;
  $base_name = $name;
  if (module_exists('locale')) {

    //First check to see if the report allready has a language in it
    @(list($tlang, $tbase_name) = explode('.', $name, 2));

    // FInd out if the starting name of the report is an installed language.
    $lang_list = language_list();
    if (array_key_exists($tlang, $lang_list)) {
      $base_name = $tbase_name;
      if ($lang != $tlang) {
        $lang = $tlang;
        $language = $lang_list[$lang];
      }
      if ($tlang == 'en') {
        $name = $tbase_name;
        $base_name = $tlang . '.' . $tbase_name;
      }
    }
    else {
      if ($lang != 'en') {
        $name = $lang . '.' . $name;
      }
    }
  }
  $desc = FrxReportGenerator::instance()
    ->report_desc($name);
  $desc['language'] = $lang;
  $desc['base_name'] = $base_name;
  return $desc;
}