Elgg  Version 3.0
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  $is_registered = false;
11  if ($subtype == '__base__') {
12  $is_registered = is_registered_entity_type($type);
13  $name = elgg_echo("collection:$type");
14  } else {
15  $is_registered = is_registered_entity_type($type, $subtype);
16  $name = elgg_echo("collection:$type:$subtype");
17  }
18 
19  if ($is_registered) {
21  } else {
22  $other[$name] = $value;
23  }
24  }
25 }
26 
27 arsort($searchable);
28 arsort($other);
29 
30 $header = '<tr><th>' . elgg_echo('admin:statistics:numentities:type') . '</th>';
31 $header .= '<th>' . elgg_echo('admin:statistics:numentities:number') . '</th></tr>';
32 
33 $rows = '';
34 
35 foreach ($searchable as $name => $value) {
36  $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>";
37 }
38 
39 $body = "<table class='elgg-table'><thead>{$header}</thead><tbody>{$rows}</tbody></table>";
40 echo elgg_view_module('info', elgg_echo('admin:statistics:numentities:searchable'), $body);
41 
42 
43 $rows = '';
44 foreach ($other as $name => $value) {
45  $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>";
46 }
47 
48 $body = "<table class='elgg-table'><thead>{$header}</thead><tbody>{$rows}</tbody></table>";
49 echo elgg_view_module('info', elgg_echo('admin:statistics:numentities:other'), $body);
$other
Definition: numentities.php:6
get_entity_statistics($owner_guid=0)
Return an array reporting the number of various entities in the system.
Definition: statistics.php:22
foreach($searchable as $name=> $value) $body
Definition: numentities.php:39
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
$subtype
Definition: delete.php:22
$type
Definition: delete.php:21
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
is_registered_entity_type($type, $subtype=null)
Returns if the entity type and subtype have been registered with elgg_register_entity_type().
Definition: entities.php:765
$header
Definition: numentities.php:30
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:1198
$rows
Definition: numentities.php:33
elgg echo
Translates a string.
Definition: languages.js:43
$searchable
Definition: numentities.php:5
$value
Definition: debugging.php:7
$subtypes
$entity_stats
Definition: numentities.php:3