Elgg  Version 5.1
numentities.php
Go to the documentation of this file.
1 <?php
2 // Get entity statistics
4 
6 $other = [];
7 
8 foreach ($entity_stats as $type => $subtypes) {
9  foreach ($subtypes as $subtype => $value) {
10  $name = "{$type} - {$subtype}";
11  if (elgg_language_key_exists("collection:{$type}:{$subtype}")) {
12  $name = elgg_echo("collection:{$type}:{$subtype}");
13  } elseif (elgg_language_key_exists("item:{$type}:{$subtype}")) {
14  $name = elgg_echo("item:{$type}:{$subtype}");
15  }
16 
17  if (elgg_entity_has_capability($type, $subtype, 'searchable')) {
19  } else {
20  $other[$name] = $value;
21  }
22  }
23 }
24 
25 arsort($searchable);
26 arsort($other);
27 
28 $header = '<tr><th>' . elgg_echo('admin:statistics:numentities:type') . '</th>';
29 $header .= '<th>' . elgg_echo('admin:statistics:numentities:number') . '</th></tr>';
30 
31 $rows = '';
32 
33 foreach ($searchable as $name => $value) {
34  $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>";
35 }
36 
37 $body = "<table class='elgg-table'><thead>{$header}</thead><tbody>{$rows}</tbody></table>";
38 echo elgg_view_module('info', elgg_echo('admin:statistics:numentities:searchable'), $body);
39 
40 
41 $rows = '';
42 foreach ($other as $name => $value) {
43  $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>";
44 }
45 
46 $body = "<table class='elgg-table'><thead>{$header}</thead><tbody>{$rows}</tbody></table>";
47 echo elgg_view_module('info', elgg_echo('admin:statistics:numentities:other'), $body);
$other
Definition: numentities.php:6
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:940
foreach($searchable as $name=> $value) $body
Definition: numentities.php:37
elgg_get_entity_statistics(int $owner_guid=0)
Return an array reporting the number of various entities in the system.
Definition: entities.php:657
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
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:22
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof\ElggRelationship) elseif(is_callable([$item, 'getType']))
Definition: item.php:48
$value
Definition: generic.php:51
elgg_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
Definition: languages.php:44
$header
Definition: numentities.php:28
$rows
Definition: numentities.php:31
$searchable
Definition: numentities.php:5
$subtype
Definition: delete.php:23
$subtypes
elgg_entity_has_capability(string $type, string $subtype, string $capability, bool $default=false)
Checks if a capability is enabled for a specified type/subtype.
Definition: entities.php:698
$entity_stats
Definition: numentities.php:3