From 23afae0aaf5e9c331c7fa218356df039fe3c8e68 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Sun, 23 Feb 2014 21:35:20 +0100 Subject: [PATCH] [UPDATE] added last 10 registered users to dashboard --- public/include/classes/user.class.php | 13 ++++++++ public/include/pages/admin/dashboard.inc.php | 4 +++ .../mpos/admin/dashboard/registrations.tpl | 32 +++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 0e02fd0f..6bc12612 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -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 diff --git a/public/include/pages/admin/dashboard.inc.php b/public/include/pages/admin/dashboard.inc.php index 4a2d4d7a..00897973 100644 --- a/public/include/pages/admin/dashboard.inc.php +++ b/public/include/pages/admin/dashboard.inc.php @@ -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( diff --git a/public/templates/mpos/admin/dashboard/registrations.tpl b/public/templates/mpos/admin/dashboard/registrations.tpl index b96ae710..500953d2 100644 --- a/public/templates/mpos/admin/dashboard/registrations.tpl +++ b/public/templates/mpos/admin/dashboard/registrations.tpl @@ -1,6 +1,8 @@ -{nocache} -
+

Registrations

+ +
+

by time

@@ -22,4 +24,28 @@
-{/nocache} + +
+

Last 10 registered Users

+
+ + + + + + + + + + +{section user $LASTREGISTEREDUSERS} + + + + + + +{/section} + +
IDUsernameeMailReg. Date
{$LASTREGISTEREDUSERS[user].id|escape}{$LASTREGISTEREDUSERS[user].username|escape}{$LASTREGISTEREDUSERS[user].email}{$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"}
+