function forena_get_user_reports in Forena Reports 7
Same name and namespace in other branches
- 8 forena.common.inc \forena_get_user_reports()
- 6.2 forena.common.inc \forena_get_user_reports()
- 6 forena.common.inc \forena_get_user_reports()
- 7.5 forena.common.inc \forena_get_user_reports()
- 7.2 forena.common.inc \forena_get_user_reports()
- 7.3 forena.common.inc \forena_get_user_reports()
- 7.4 forena.common.inc \forena_get_user_reports()
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 901 - Common functions used throughout the project but loaded in this file to keep the module file lean.
Code
function forena_get_user_reports() {
$result = db_query('SELECT * FROM {forena_reports} where hidden=0 ORDER BY category,title asc');
$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;
}