[UPDATE] added last 10 registered users to dashboard

This commit is contained in:
iAmShorty 2014-02-23 21:35:20 +01:00
parent 7ffa620975
commit 23afae0aaf
3 changed files with 46 additions and 3 deletions

View File

@ -115,6 +115,19 @@ class User extends Base {
}
}
/**
* Fetch last registered users for administrative tasks
* @param none
* @return data array All users with db columns as array fields
**/
public function getLastRegisteredUsers($limit=10) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("SELECT * FROM " . $this->getTableName() . " ORDER BY id DESC LIMIT ?");
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $limit) && $stmt->execute() && $result = $stmt->get_result()) {
return $result->fetch_all(MYSQLI_ASSOC);
}
}
/**
* Check user login
* @param username string Username

View File

@ -64,6 +64,10 @@ $aRegistrationInfo = array(
);
$smarty->assign('USER_REGISTRATIONS', $aRegistrationInfo);
// get last 10 Registrations
$aLastRegisteredUsers = $user->getLastRegisteredUsers();
$smarty->assign("LASTREGISTEREDUSERS", $aLastRegisteredUsers);
// Fetch invitation information
if (!$setting->getValue('disable_invitations')) {
$aInvitationInfo = array(

View File

@ -1,6 +1,8 @@
{nocache}
<article class="module width_quarter">
<article class="module width_full">
<header><h3>Registrations</h3></header>
<article class="module width_quarter">
<header><h3>by time</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
@ -22,4 +24,28 @@
</tbody>
</table>
</article>
{/nocache}
<article class="module width_half" style="min-height: 350px">
<header><h3>Last 10 registered Users</h3></header>
<div>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th align="center">ID</th>
<th>Username</th>
<th align="left">eMail</th>
<th align="center">Reg. Date</th>
</tr>
</thead>
<tbody>
{section user $LASTREGISTEREDUSERS}
<tr class="{cycle values="odd,even"}">
<td align="center">{$LASTREGISTEREDUSERS[user].id|escape}</td>
<td>{$LASTREGISTEREDUSERS[user].username|escape}</td>
<td align="left">{$LASTREGISTEREDUSERS[user].email}</td>
<td align="center">{$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"}</td>
</tr>
{/section}
</tbody>
</table>
</article>