diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 58ebc4b2..ebd6f843 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -133,6 +133,26 @@ class User extends Base { return $result->fetch_all(MYSQLI_ASSOC); } } + + /** + * Fetch Top 10 Inviters + * @param none + * @return data array All users with db columns as array fields + **/ + public function getTopInviters($limit=10) { + $this->debug->append("STA " . __METHOD__, 4); + $stmt = $this->mysqli->prepare(" + SELECT COUNT(i.account_id) as invitationcount,a.id,a.username,a.email, + (SELECT COUNT(account_id) FROM invitations WHERE account_id = i.account_id AND is_activated = 1 GROUP BY account_id) AS activated + FROM invitations AS i + LEFT JOIN " . $this->getTableName() . " AS a + ON a.id = i.account_id + GROUP BY i.account_id + 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 diff --git a/public/include/pages/admin/dashboard.inc.php b/public/include/pages/admin/dashboard.inc.php index 00897973..32ee6a7d 100644 --- a/public/include/pages/admin/dashboard.inc.php +++ b/public/include/pages/admin/dashboard.inc.php @@ -68,8 +68,13 @@ $smarty->assign('USER_REGISTRATIONS', $aRegistrationInfo); $aLastRegisteredUsers = $user->getLastRegisteredUsers(); $smarty->assign("LASTREGISTEREDUSERS", $aLastRegisteredUsers); -// Fetch invitation information +// Fetching invitation Informations if (!$setting->getValue('disable_invitations')) { + // get last 10 Inviters + $aTopInviters = $user->getTopInviters(); + $smarty->assign("TOPINVITERS", $aTopInviters); + + // Fetch global invitation information $aInvitationInfo = array( 'total' => $invitation->getCount(), 'activated' => $invitation->getCountFiltered('is_activated', 1), diff --git a/public/templates/mpos/admin/dashboard/default.tpl b/public/templates/mpos/admin/dashboard/default.tpl index 36dabf89..aca2e4dd 100644 --- a/public/templates/mpos/admin/dashboard/default.tpl +++ b/public/templates/mpos/admin/dashboard/default.tpl @@ -2,4 +2,7 @@ {include file="admin/dashboard/mpos.tpl"} {include file="admin/dashboard/user.tpl"} {include file="admin/dashboard/registrations.tpl"} +{if $GLOBAL.config.disable_invitations|default:"0" == 0} +{include file="admin/dashboard/invitation.tpl"} +{/if} {/nocache} diff --git a/public/templates/mpos/admin/dashboard/invitation.tpl b/public/templates/mpos/admin/dashboard/invitation.tpl new file mode 100644 index 00000000..7b90b42d --- /dev/null +++ b/public/templates/mpos/admin/dashboard/invitation.tpl @@ -0,0 +1,53 @@ +{nocache} +
+

Invitations

+ +
+

Overview

+ + + + + + + + + + + + + + + +
TotalActivatedOutstanding
{$INVITATION_INFO.total}{$INVITATION_INFO.activated}{$INVITATION_INFO.outstanding}
+
+ +
+

Top 10 Inviters

+
+ + + + + + + + + + + +{section inviter $TOPINVITERS} + + + + + + + +{/section} + +
UsernameeMailAmountOutstandingActivated
{$TOPINVITERS[inviter].username|escape}{$TOPINVITERS[inviter].email}{$TOPINVITERS[inviter].invitationcount}{($TOPINVITERS[inviter].invitationcount - $TOPINVITERS[inviter].activated)|number_format:"0"}{$TOPINVITERS[inviter].activated}
+
+ +
+{/nocache} \ No newline at end of file diff --git a/public/templates/mpos/admin/dashboard/registrations.tpl b/public/templates/mpos/admin/dashboard/registrations.tpl index 5aa16f59..43977924 100644 --- a/public/templates/mpos/admin/dashboard/registrations.tpl +++ b/public/templates/mpos/admin/dashboard/registrations.tpl @@ -25,7 +25,7 @@ -
+

Last 10 registered Users

@@ -46,11 +46,12 @@ - - + + {/section}
{$LASTREGISTEREDUSERS[user].mposuser} {$LASTREGISTEREDUSERS[user].email} {$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"}{if !$LASTREGISTEREDUSERS[user].inviter}NO{else}YES{/if}{$LASTREGISTEREDUSERS[user].inviter}{if !$LASTREGISTEREDUSERS[user].inviter}{else}{/if}{$LASTREGISTEREDUSERS[user].inviter}
+
\ No newline at end of file diff --git a/public/templates/mpos/admin/dashboard/user.tpl b/public/templates/mpos/admin/dashboard/user.tpl index 0855d6a0..66ffcf72 100644 --- a/public/templates/mpos/admin/dashboard/user.tpl +++ b/public/templates/mpos/admin/dashboard/user.tpl @@ -1,74 +1,54 @@ {nocache}
-

User Informations

+

User Information

-
-

Users

- - - - - - - - - - - - - - - - - - - -
TotalActiveLockedAdminsNo Fees
{$USER_INFO.total}{$USER_INFO.active}{$USER_INFO.locked}{$USER_INFO.admins}{$USER_INFO.nofees}
-
-{if $GLOBAL.config.disable_invitations|default:"0" == 0} -
-

Invitations

- - - - - - - - - - - - - - - -
TotalActivatedOutstanding
{$INVITATION_INFO.total}{$INVITATION_INFO.activated}{$INVITATION_INFO.outstanding}
-
-{/if} -
-

Logins

- - - - - - - - - - - - - - - - - - - -
24 hours7 days1 month6 months1 year
{$USER_LOGINS.24hours}{$USER_LOGINS.7days}{$USER_LOGINS.1month}{$USER_LOGINS.6month}{$USER_LOGINS.1year}
-
+
+

Users

+ + + + + + + + + + + + + + + + + + + +
TotalActiveLockedAdminsNo Fees
{$USER_INFO.total}{$USER_INFO.active}{$USER_INFO.locked}{$USER_INFO.admins}{$USER_INFO.nofees}
+
+ +
+

Logins

+ + + + + + + + + + + + + + + + + + + +
24 hours7 days1 month6 months1 year
{$USER_LOGINS.24hours}{$USER_LOGINS.7days}{$USER_LOGINS.1month}{$USER_LOGINS.6month}{$USER_LOGINS.1year}
+
{/nocache} \ No newline at end of file diff --git a/public/templates/mpos/admin/user/default.tpl b/public/templates/mpos/admin/user/default.tpl index 38c414f6..6e2914d8 100644 --- a/public/templates/mpos/admin/user/default.tpl +++ b/public/templates/mpos/admin/user/default.tpl @@ -86,17 +86,17 @@ ID Username E-Mail - Shares   - Hashrate   + Shares + Hashrate {if $GLOBAL.config.payout_system != 'pps'} - Est. Donation   - Est. Payout    + Est. Donation + Est. Payout {else} - Est. 24 Hours    + Est. 24 Hours {/if} - Balance    - Reg. Date    - Last Login    + Balance + Reg. Date + Last Login Admin Locked No Fees