Elgg  Version 6.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 
14 if (empty($registered_entity_types)) {
15  echo elgg_view('output/longtext', [
16  'value' => elgg_echo('notfound'),
17  ]);
18 }
19 
20 $stats = [];
21 
23  foreach ($subtypes as $subtype) {
24  $value = elgg_extract($subtype, elgg_extract($type, $entity_stats), false);
25  if ($value !== false) {
26  $stats[elgg_echo("collection:{$type}:{$subtype}")] = $value;
27  }
28  }
29 }
30 
31 arsort($stats);
32 
33 echo '<table class="elgg-table">';
34 echo '<thead><tr>';
35 echo elgg_format_element('th', [], elgg_echo('admin:statistics:numentities:type'));
36 echo elgg_format_element('th', [], elgg_echo('admin:statistics:numentities:number'));
37 echo '</tr></thead>';
38 echo '<tbody>';
39 
40 foreach ($stats as $name => $num) {
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 ]);
if(empty($registered_entity_types)) $stats
Definition: content.php:20
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
if(elgg_in_context('default_widgets')) $widget
Definition: content.php:8
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$type
Definition: delete.php:21
if(!$widget instanceof\ElggWidget) $entity_stats
Definition: content.php:11
elgg_get_entity_statistics(array $options=[])
Return an array reporting the number of various entities in the system.
Definition: entities.php:661
$value
Definition: generic.php:51
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:256
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$registered_entity_types
Definition: content.php:13
$vars
Definition: theme.php:5
elgg_view_url(string $href, string $text=null, array $options=[])
Helper function for outputting urls.
Definition: views.php:1427
$subtype
Definition: delete.php:22
$subtypes
elgg_entity_types_with_capability(string $capability)
Returns an array of type/subtypes with the requested capability enabled.
Definition: entities.php:757
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145