function forena_report in Forena Reports 7.4
Same name and namespace in other branches
- 8 forena.module \forena_report()
- 6.2 forena.module \forena_report()
- 6 forena.module \forena_report()
- 7.5 forena.module \forena_report()
- 7 forena.module \forena_report()
- 7.2 forena.module \forena_report()
- 7.3 forena.module \forena_report()
Load and render a report based on a drupal path. In this function the arglist is used to get the full path to the report.
Return value
string|array Render array or content.
6 calls to forena_report()
- drush_forena_report in ./
forena.drush.inc - Run a report to a fiel.
- ForenaViewsPlugin::render in ./
ForenaViewsPlugin.inc - Render the display in this style.
- forena_report_menu_callback in ./
forena.module - Menu callback for rendering the forena report.
- forena_report_page_callback in ./
forena.module - FrxBean::view in bean/
FrxBean.inc - Return the block content.
1 string reference to 'forena_report'
- forena_menu in ./
forena.module - Implementation of hook_menu.
File
- ./
forena.module, line 1082
Code
function forena_report($name_in, $parms = NULL, $print = TRUE, $filename = '') {
$in_block = FALSE;
if ($print === 'block') {
$in_block = TRUE;
}
require_once 'forena.common.inc';
$desc = Frx::Menu()
->parseURL($name_in);
$time = @new DateTime();
$desc['time'] = date_format($time, 'Y-m-d H:i:s');
$desc['basepath'] = base_path();
$desc['path'] = $desc['basepath'] . Frx::File()
->directory(Frx::File()
->path($desc['filename'], TRUE));
$path_info = Frx::File()
->pathinfo($desc['filename']);
$desc['dir'] = base_path() . $path_info['dirname'];
$desc['theme'] = $desc['basepath'] . drupal_get_path('theme', $GLOBALS['theme']);
$desc['print'] = $print;
$desc['q'] = $_GET['q'];
$desc['always_redirect'] = $in_block;
if (!$desc['exists']) {
watchdog('error', 'Report %s not found', array(
'%s' => $name_in,
), WATCHDOG_ERROR);
if ($print) {
drupal_not_found();
exit;
}
return '';
}
FrxData::instance()
->setContext('cookie', $_COOKIE);
FrxData::instance()
->setContext('report', $desc);
$report_name = $desc['name'];
// Load dataTable plugin if possible.
//forena_include_data_tables();
$o = Frx::Editor($name_in, FALSE);
$o->alwaysRedirect = $in_block;
$content = $o
->report($parms, $print, FALSE, $filename);
$m_path = drupal_get_path('module', 'forena');
if ($content) {
// This has been deprecated, but we'll eave it in for now.
if ($print) {
drupal_add_js($m_path . '/forena.js');
}
$forena_js = array();
$forena_js['form'] = preg_replace('/[^\\w\\-]+/u', '_', Frx::Skin()->name);
$forena_js['report'] = preg_replace('/[^\\w\\-]+/u', '_', $name_in);
if ($print) {
drupal_add_js(array(
'forena' => $forena_js,
), 'setting');
}
}
if (!$print && is_array($content)) {
return drupal_render($content['content']);
}
return $content;
}