Elgg  Version 3.0
content.php
Go to the documentation of this file.
1 <?php
6 /* @var $widget \ElggWidget */
7 $widget = elgg_extract('entity', $vars);
8 
10 
12 if (empty($registered_entity_types)) {
13  echo elgg_view('output/longtext', [
14  'value' => elgg_echo('notfound'),
15  ]);
16 }
17 
18 $stats = [];
19 
21  if (!empty($subtypes)) {
22  foreach ($subtypes as $subtype) {
23  $value = elgg_extract($subtype, elgg_extract($type, $entity_stats), false);
24  if ($value !== false) {
25  $stats[elgg_echo("collection:$type:$subtype")] = $value;
26  }
27  }
28  } else {
29  $value = elgg_extract('__base__', elgg_extract($type, $entity_stats), false);
30  if ($value !== false) {
31  $stats[elgg_echo("collection:$type")] = $value;
32  }
33  }
34 }
35 
36 arsort($stats);
37 
38 echo '<table class="elgg-table">';
39 echo '<thead><tr><th>' . elgg_echo('admin:statistics:numentities:type') . '</th>';
40 echo '<th>' . elgg_echo('admin:statistics:numentities:number') . '</th></tr></thead>';
41 foreach ($stats as $name => $num) {
42  echo "<tr><td>$name</td><td>$num</td></tr>";
43 }
44 echo '</table>';
45 
46 echo '<div class="mtm elgg-widget-more">';
47 echo elgg_view('output/url', [
48  'href' => 'admin/statistics/numentities',
49  'text' => elgg_echo('more'),
50  'is_trusted' => true,
51 ]);
52 echo '</div>';
get_entity_statistics($owner_guid=0)
Return an array reporting the number of various entities in the system.
Definition: statistics.php:22
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
if(empty($registered_entity_types)) $stats
Definition: content.php:18
if(elgg_in_context('default_widgets')) $widget
Definition: content.php:8
$entity_stats
Definition: content.php:9
$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
get_registered_entity_types($type=null)
Returns registered entity types and subtypes.
Definition: entities.php:736
elgg echo
Translates a string.
Definition: languages.js:43
$registered_entity_types
Definition: content.php:11
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
$value
Definition: debugging.php:7
$vars['type']
Definition: save.php:11
$subtypes
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246