Elgg  Version 7.1
content.php
Go to the documentation of this file.
1 <?php
6 $widget = elgg_extract('entity', $vars);
7 if (!$widget instanceof \ElggWidget) {
8  return;
9 }
10 
12 if (empty($registered_entity_types)) {
13  echo elgg_view_no_results();
14  return;
15 }
16 
17 $stats = [];
19 
21  foreach ($subtypes as $subtype) {
23  if ($value !== false) {
24  $stats[elgg_echo("collection:{$type}:{$subtype}")] = $value;
25  }
26  }
27 }
28 
29 arsort($stats);
30 
31 echo '<table class="elgg-table">';
32 echo '<thead><tr>';
33 echo elgg_format_element('th', [], elgg_echo('admin:statistics:numentities:type'));
34 echo elgg_format_element('th', [], elgg_echo('admin:statistics:numentities:number'));
35 echo '</tr></thead>';
36 echo '<tbody>';
37 
38 foreach ($stats as $name => $num) {
39  $num = elgg_number_format($num);
40 
41  echo "<tr><td>{$name}</td><td>{$num}</td></tr>";
42 }
43 
44 echo '</tbody>';
45 echo '</table>';
46 
47 echo elgg_view('page/components/list/widget_more', [
48  'widget_more' => elgg_view_url($widget->getURL(), elgg_echo('more')),
49 ]);
$vars
Definition: theme.php:3
if(! $user||! $user->canDelete()) $name
Definition: delete.php:22
$subtype
Definition: delete.php:22
$type
Definition: delete.php:21
$subtypes
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:246
$value
Definition: generic.php:51
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
elgg_entity_types_with_capability(string $capability)
Returns an array of type/subtypes with the requested capability enabled.
Definition: entities.php:757
elgg_get_entity_statistics(array $options=[])
Return an array reporting the number of various entities in the system.
Definition: entities.php:661
elgg_view_no_results(string $text='')
Helper function to display a no results view.
Definition: views.php:1517
elgg_view_url(string $href, ?string $text=null, array $options=[])
Helper function for outputting urls.
Definition: views.php:1472
elgg_view(string $view, array $vars=[], string $viewtype='')
Return a parsed view.
Definition: views.php:156
if(elgg_in_context('default_widgets')) $widget
Definition: content.php:8
elgg_format_element(string $tag_name, array $attributes=[], string $text='', array $options=[])
Format an HTML element.
Definition: output.php:145
elgg_number_format(float $number, int $decimals=0)
Format a number with grouped thousands using language specific separators.
Definition: output.php:368
$entity_stats
Definition: content.php:18
if(empty($registered_entity_types)) $stats
Definition: content.php:17
if(! $widget instanceof \ElggWidget) $registered_entity_types
Definition: content.php:11