' . (($statistics == NULL) ? ('
' . JText :: _('ERROR_RETRIEVING_STATISTICS') . '
') : implode('', array_map(function ($statistic) use ($baseUrl) {return BrowseHelper :: formatStatistic($statistic, $baseUrl);}, $statistics))) . '
';
//return '' . JText :: _('AT_A_GLANCE') . '
' . (($statistics == NULL) ? ('
' . JText :: _('ERROR_RETRIEVING_STATISTICS') . '
') : implode('', array_map(function ($statistic) use ($baseUrl) {return BrowseHelper :: formatStatistic($statistic, $baseUrl);}, $statistics))) . '
';
}
// Format a single statistic.
// $statistic the statistic to format
// $baseUrl the base URL to use for links
// return a string containing the full HTML for the statistic or an empty string if any errors occur
public static function formatStatistic($statistic, $baseUrl, $type="") {
// TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this
mb_internal_encoding('UTF-8');
$data = ($statistic -> data == NULL) ? NULL : array_map(function ($row) use ($statistic, $baseUrl) {
//encode '&' to '%26' otherwise it takes it as a parameter
$row -> id= str_replace('&','%26',$row -> id);
return '' . $statistic -> title . '
' . (($statistic -> data == NULL) ? ('
' . $statistic -> error . '
') : ('' . implode('
', array_slice($data, 0, BrowseHelper :: MAX_ROWS)) . ((count($data) > BrowseHelper :: MAX_ROWS) ? ('
' . JText :: _('VIEW_MORE') . '') : '') . '')) . ((count($data) > BrowseHelper :: MAX_ROWS) ? ('
' . implode('
', $data) . '
') : '') . '
';
}
}