Beispiel #1
0
<?php

// Get entity statistics
$entity_stats = get_entity_statistics();
$selected_entities = $vars["entity"]->selected_entities;
if ($entity_stats) {
    ?>
	<table class='elgg-table'>
	<?php 
    foreach ($entity_stats as $k => $entry) {
        arsort($entry);
        foreach ($entry as $a => $b) {
            $key = $k . "|" . $a;
            if (empty($selected_entities) || in_array($key, $selected_entities)) {
                if ($a == "__base__") {
                    $a = elgg_echo("item:{$k}");
                    if ($k == "user") {
                        $b .= " (" . elgg_echo("admin:users:online") . " " . find_active_users(array("seconds" => 600, "count" => true)) . ")";
                    }
                } else {
                    if (empty($a)) {
                        $a = elgg_echo("item:{$k}");
                    } else {
                        $a = elgg_echo("item:{$k}:{$a}");
                    }
                    if (empty($a)) {
                        $a = "{$k} {$a}";
                    }
                }
                echo "<tr><td>{$a}:</td><td>{$b}</td></tr>";
            }
Beispiel #2
0
<?php

/**
 * Elgg statistics screen
 *
 * @package Elgg
 * @subpackage Core
 */
// Get entity statistics
$entity_stats = get_entity_statistics(elgg_get_page_owner_guid());
if ($entity_stats) {
    $rows = '';
    $even_odd = null;
    foreach ($entity_stats as $k => $entry) {
        foreach ($entry as $a => $b) {
            // This function controls the alternating class
            $even_odd = 'odd' != $even_odd ? 'odd' : 'even';
            if ($a == "__base__") {
                $a = elgg_echo("item:{$k}");
                if (empty($a)) {
                    $a = $k;
                }
            } else {
                $a = elgg_echo("item:{$k}:{$a}");
                if (empty($a)) {
                    $a = "{$k} {$a}";
                }
            }
            $rows .= <<<END
\t\t\t\t<tr class="{$even_odd}">
\t\t\t\t\t<td class="column-one"><b>{$a}:</b></td>
/**
 * Get the valid types for add views counter plugin
 */
function get_valid_types_for_views_counter()
{
    $statistics = get_entity_statistics();
    $valid_types = array('user', 'group');
    foreach ($statistics['object'] as $subtype => $counter) {
        if ($subtype != 'plugin' && $subtype != '__base__') {
            $valid_types[] = $subtype;
        }
    }
    return $valid_types;
}
Beispiel #4
0
<?php

/**
 * Elgg statistics screen
 *
 * @package Elgg
 * @subpackage Core
 * @author Curverider Ltd
 * @link http://elgg.org/
 */
// Get entity statistics
$entity_stats = get_entity_statistics($_SESSION['user']->guid);
if ($entity_stats) {
    ?>
<div class="user_settings statistics">
	<h3><?php 
    echo elgg_echo('usersettings:statistics:label:numentities');
    ?>
</h3>
	<table class="styled">
		<?php 
    foreach ($entity_stats as $k => $entry) {
        foreach ($entry as $a => $b) {
            //This function controls the alternating class
            $even_odd = 'odd' != $even_odd ? 'odd' : 'even';
            if ($a == "__base__") {
                $a = elgg_echo("item:{$k}");
                if (empty($a)) {
                    $a = $k;
                }
            } else {
<?php

/**
 * Elgg statistics screen
 *
 * @package Elgg
 * @subpackage Core
 */
// Get entity statistics
$entity_stats = get_entity_statistics(elgg_get_logged_in_user_guid());
if ($entity_stats) {
    ?>
<div class="elgg-module elgg-module-info">
	<div class="elgg-head">
		<h3><?php 
    echo elgg_echo('usersettings:statistics:label:numentities');
    ?>
</h3>
	</div>
	<div class="elgg-body">
		<table class="elgg-table-alt">
		<?php 
    foreach ($entity_stats as $k => $entry) {
        foreach ($entry as $a => $b) {
            //This function controls the alternating class
            $even_odd = 'odd' != $even_odd ? 'odd' : 'even';
            if ($a == "__base__") {
                $a = elgg_echo("item:{$k}");
                if (empty($a)) {
                    $a = $k;
                }
 /**
  * Tests get_entity_statistics() with an owner
  * @covers get_entity_statistics()
  */
 function test_owned_get_entity_statistics()
 {
     $user = new \ElggUser();
     $user->save();
     $subtype = 'issue7845' . rand(0, 100);
     $object = new \ElggObject();
     $object->subtype = $subtype;
     $object->owner_guid = $user->guid;
     $object->save();
     $stats = get_entity_statistics($user->guid);
     $this->assertEqual($stats['object'][$subtype], 1);
     $user->delete();
 }