public function ForenaController::listUserReports in Forena Reports 8
Generate the list of user reports.
Return value
string
1 string reference to 'ForenaController::listUserReports'
File
- src/
Controller/ ForenaController.php, line 111
Class
Namespace
Drupal\forena\ControllerCode
public function listUserReports() {
$content = [];
$reports = ReportFileSystem::instance()
->reportsByCategory();
if (!$reports) {
$content = [
'#type' => 'html_tag',
'#value' => 'No Reports Found',
'#tag' => 'p',
];
}
else {
$links = [];
$output = '';
foreach ($reports as $category => $cat_reports) {
$links[] = '<li><a href="#' . urlencode($category) . '">' . $category . '</a></li> ';
$output .= '<h3 id="' . urlencode($category) . '">' . $category . '</h3>';
$output .= '<ul>';
foreach ($cat_reports as $r) {
$report = str_replace('/', '.', $r['report_name']);
$parms = [
'report' => $report,
];
$output .= '<li>' . $this
->l($r['title'], Url::fromRoute('forena.report', $parms)) . '</li>';
}
$output .= '</ul>';
}
$content['#markup'] = $output;
}
return $content;
}