1 | <?php |
||
2 | // Get entity statistics |
||
3 | $entity_stats = get_entity_statistics(); |
||
4 | |||
5 | $registered_entity_types = get_registered_entity_types(); |
||
6 | |||
7 | $searchable = []; |
||
8 | $other = []; |
||
9 | |||
10 | foreach ($entity_stats as $type => $subtypes) { |
||
11 | foreach ($subtypes as $subtype => $value) { |
||
12 | $is_registered = false; |
||
13 | if ($subtype == '__base__') { |
||
14 | $is_registered = array_key_exists($type, $registered_entity_types); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
15 | $name = elgg_echo("item:$type"); |
||
16 | } else { |
||
17 | $is_registered = in_array($subtype, $registered_entity_types[$type]); |
||
18 | $name = elgg_echo("item:$type:$subtype"); |
||
19 | } |
||
20 | |||
21 | if ($is_registered) { |
||
22 | $searchable[$name] = $value; |
||
23 | } else { |
||
24 | $other[$name] = $value; |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 | |||
29 | arsort($searchable); |
||
30 | arsort($other); |
||
31 | |||
32 | $header = '<tr><th>' . elgg_echo('admin:statistics:numentities:type') . '</th>'; |
||
33 | $header .= '<th>' . elgg_echo('admin:statistics:numentities:number') . '</th></tr>'; |
||
34 | |||
35 | $rows = ''; |
||
36 | |||
37 | foreach ($searchable as $name => $value) { |
||
38 | $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>"; |
||
39 | } |
||
40 | echo '<h4>' . elgg_echo('admin:statistics:numentities:searchable') . '</h4>'; |
||
41 | echo "<table class='elgg-table-alt'>{$header}{$rows}</table>"; |
||
42 | echo '<br />'; |
||
43 | |||
44 | |||
45 | $rows = ''; |
||
46 | foreach ($other as $name => $value) { |
||
47 | $rows .= "<tr><td>{$name}</td><td>{$value}</td></tr>"; |
||
48 | } |
||
49 | echo '<h4>' . elgg_echo('admin:statistics:numentities:other') . '</h4>'; |
||
50 | echo "<table class='elgg-table-alt'>{$header}{$rows}</table>"; |
||
51 |