1
0

Added a "User stats" section to user profiles.

This commit is contained in:
rWatcher 2012-06-13 14:46:57 -04:00
parent ae29a70a4d
commit 27dbbd0716
2 changed files with 21 additions and 0 deletions

View File

@ -107,4 +107,16 @@ class quotas_event_Core {
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->add_item($item);
}
static function show_user_profile($data) {
$v = new View("user_profile_quotas.html");
$quotas_record = ORM::factory("users_space_usage")->where("owner_id", "=", $data->user->id)->find();
$v->user_profile_data = array();
$v->user_profile_data[(string) t("Albums")] = db::build()->from("items")->where("type", "=", "album")->where("owner_id", "=", $data->user->id)->count_records();
$v->user_profile_data[(string) t("Uploads")] = db::build()->from("items")->where("type", "!=", "album")->where("owner_id", "=", $data->user->id)->count_records();
$v->user_profile_data[(string) t("Disc Usage")] = $quotas_record->total_usage_string();
$data->content[] = (object) array("title" => t("User stats"), "view" => $v);
}
}

View File

@ -0,0 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<table>
<? foreach ($user_profile_data as $label => $value): ?>
<tr>
<th><?= html::clean($label) ?></th>
<td><?= html::purify($value) ?></td>
</tr>
<? endforeach ?>
</table>