' . JText :: _('REFINE_BY') . '
' . implode('', $statistics) . '
'); } public static function _formatStatistic($statistic, $filters, $baseUrl, $fragment) { $hasExtraFunder=(array_key_exists($statistic -> id, $filters) && strpos($statistic -> id, 'funder') !== FALSE); $data = (($statistic -> data == NULL) || (array_key_exists($statistic -> id, $filters)&& strpos($statistic -> id, 'funder') === FALSE)) ? NULL : array_filter(array_map(function ($row) use ($statistic, $filters, $baseUrl, $fragment,$hasExtraFunder) {return ($hasExtraFunder)?StatisticHelper :: _formatRowForFunder($row, $statistic -> id, $filters, $baseUrl, $fragment):StatisticHelper :: _formatRow($row, $statistic -> id, $filters, $baseUrl, $fragment);}, $statistic -> data)); return ($data == NULL) ? '' : ('

' .(($hasExtraFunder)?JText :: _('ALSO_FUNDED_BY'): $statistic -> title ). '

' . implode('
', array_slice($data, 0, StatisticHelper :: MAX_ROWS)) . ((count($data) > StatisticHelper :: MAX_ROWS) ? ('
' . JText :: _('VIEW_MORE') . '
' . $statistic -> title . '

' . implode('
', $data) . '

') : '') . '
'); } public static function _formatRow($row, $statisticId, $filters, $baseUrl, $fragment) { $filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($filter) use ($statisticId) {return ($filter -> name == $statisticId) ? '' : (urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)));}, $filters)); // TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this mb_internal_encoding('UTF-8'); //encode '&' to '%26' otherwise it takes it as a parameter $row -> id= str_replace('&','%26',$row -> id); if($row -> name =="unidentified"){ // down't show unidentified projects return ""; } return '' . ((strlen($row -> name.'(' . $row -> count . ')') > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...(' . $row -> count . ')')) . '...') : $row -> name ) . ' (' . $row -> count . ')'; } public static function _formatRowForFunder($row, $statisticId, $filters, $baseUrl, $fragment) { $funderId=($filters['funder']!==null)?'funder':'funderFilter'; $funders=($filters[$funderId]==null)?'':$filters[$funderId] -> name.'='.$filters[$funderId] -> value; $filters = ($filters == NULL) ? NULL : array_filter(array_map(function ($filter) use ($statisticId) {return ($filter -> name == $statisticId) ? '' : (urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)));}, $filters)); // TODO JRoute :: _ keeps decoding urlencoded values, so this is just a hack to cope with this mb_internal_encoding('UTF-8'); //encode '&' to '%26' otherwise it takes it as a parameter $row -> id= str_replace('&','%26',$row -> id); return (strpos($funders, $row -> id) !== FALSE)?'':'' . ((strlen($row -> name.'(' . $row -> count . ')') > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...(' . $row -> count . ')')) . '...') : $row -> name ) . ' (' . $row -> count . ')'; } }