public function FrxReportFile::buildCache in Forena Reports 7.4
Should load cache data based on that.
Overrides FrxFile::buildCache
See also
File
- ./
FrxReportFile.inc, line 189
Class
Code
public function buildCache($ext, $base_name, &$object) {
switch ($ext) {
case 'frx':
// Save language info
$lang = 'en';
if (module_exists('locale')) {
@(list($tlang, $tname) = explode('/', $base_name, 2));
if (array_key_exists($tlang, language_list())) {
$lang = $tlang;
}
}
try {
$r_xml = file_get_contents($object->file);
// Load the report
$r = @new FrxReport($r_xml);
} catch (Exception $e) {
}
if (!$r->rpt_xml) {
$s = t('Unable to load Report %s', array(
'%s' => $object->file,
));
if (user_access('design any report')) {
drupal_set_message($s, 'error', FALSE);
}
}
// Get the security caches from the reports
$cache = isset($r->rpt_xml) ? forena_load_cache($r->rpt_xml) : NULL;
if ($r->rpt_xml) {
$cache['title'] = $r->title;
$cache['language'] = $lang;
$cache['category'] = $r->category;
$cache['hidden'] = @$r->options['hidden'];
}
$object->cache = $cache;
if ($r) {
$r
->__destruct();
}
unset($r);
break;
case 'skinfo':
$object->cache = drupal_parse_info_format(file_get_contents($object->file));
break;
}
}