Added a "User stats" section to user profiles.
This commit is contained in:
parent
ae29a70a4d
commit
27dbbd0716
@ -107,4 +107,16 @@ class quotas_event_Core {
|
|||||||
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
|
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
|
||||||
$record->add_item($item);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
9
3.0/modules/quotas/views/user_profile_quotas.html.php
Normal file
9
3.0/modules/quotas/views/user_profile_quotas.html.php
Normal 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>
|
Reference in New Issue
Block a user