[ADDED] User overview in admin dashboard
* Total users * Locked users * Admin users * No Fees users Thanks @daygle for the suggestion! Fixes #1277 once merged
This commit is contained in:
parent
777a367feb
commit
549477a7ad
@ -115,6 +115,32 @@ class Base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch count of all entries in table
|
||||
* @param none
|
||||
* @param data mixed Count or false
|
||||
**/
|
||||
public function getCount() {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("SELECT COUNT(id) AS count FROM $this->table");
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_object()->count;
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch count of all entries in table filtered by a column/value
|
||||
* @param none
|
||||
* @param data mixed Count or false
|
||||
**/
|
||||
public function getCountFiltered($column='id', $value=NULL, $type='i') {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("SELECT COUNT(id) AS count FROM $this->table WHERE $column = ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param($type, $value) && $stmt->execute() && $result = $stmt->get_result())
|
||||
return $result->fetch_object()->count;
|
||||
return $this->sqlError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all entries as an assoc array from a table
|
||||
* This should, in general, not be used but sometimes it's just easier
|
||||
|
||||
@ -36,6 +36,15 @@ foreach ($aCrons as $strCron) {
|
||||
$smarty->assign('CRON_ERROR', $cron_errors);
|
||||
$smarty->assign('CRON_DISABLED', $cron_disabled);
|
||||
|
||||
// Fetch user information
|
||||
$aUserInfo = array(
|
||||
'total' => $user->getCount(),
|
||||
'locked' => $user->getCountFiltered('is_locked', 1),
|
||||
'admins' => $user->getCountFiltered('is_admin', 1),
|
||||
'nofees' => $user->getCountFiltered('no_fees', 1)
|
||||
);
|
||||
$smarty->assign('USER_INFO', $aUserInfo);
|
||||
|
||||
// Wallet status
|
||||
$smarty->assign('WALLET_ERROR', $aGetInfo['errors']);
|
||||
|
||||
|
||||
@ -34,6 +34,29 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</article>
|
||||
|
||||
<article class="module width_quarter">
|
||||
<header><h3>Users</h3></header>
|
||||
<table class="tablesorter" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="center">Total</th>
|
||||
<th align="center">Locked</th>
|
||||
<th align="center">Admins</th>
|
||||
<th align="center">No Fees</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center">{$USER_INFO.total}</td>
|
||||
<td align="center">{$USER_INFO.locked}</td>
|
||||
<td align="center">{$USER_INFO.admins}</td>
|
||||
<td align="center">{$USER_INFO.nofees}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</article>
|
||||
|
||||
<article class="module width_quarter">
|
||||
<header><h3>MPOS Status</h3></header>
|
||||
<table class="tablesorter" cellspacing="0">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user