diff --git a/src/application/controller/common/footer.php b/src/application/controller/common/footer.php index 3caab08..e3fe90e 100644 --- a/src/application/controller/common/footer.php +++ b/src/application/controller/common/footer.php @@ -1,3 +1,6 @@ getTotal(); +$blocksTotal = $_modelBlock->getTotal(); + require(PROJECT_DIR . '/application/view/common/footer.phtml'); \ No newline at end of file diff --git a/src/application/model/block.php b/src/application/model/block.php index 5f403e6..c8df5d3 100644 --- a/src/application/model/block.php +++ b/src/application/model/block.php @@ -2,6 +2,21 @@ class ModelBlock extends Model { + public function getTotal() { + + try { + + $query = $this->_db->query("SELECT COUNT(*) AS `total` from `block`"); + + return $query->fetch()['total']; + + } catch (PDOException $e) { + + trigger_error($e->getMessage()); + return false; + } + } + public function getNextBlock() { try { diff --git a/src/application/model/user.php b/src/application/model/user.php index c32a8b4..e9dc282 100644 --- a/src/application/model/user.php +++ b/src/application/model/user.php @@ -2,6 +2,21 @@ class ModelUser extends Model { + public function getTotal() { + + try { + + $query = $this->_db->query("SELECT COUNT(*) AS `total` from `user`"); + + return $query->fetch()['total']; + + } catch (PDOException $e) { + + trigger_error($e->getMessage()); + return false; + } + } + public function userNameExists(string $userName) { try { @@ -10,7 +25,7 @@ class ModelUser extends Model { $query->execute([$userName]); - return $query->rowCount() ? $query->fetch()['total'] : 0; + return $query->fetch()['total']; } catch (PDOException $e) { diff --git a/src/application/view/common/footer.phtml b/src/application/view/common/footer.phtml index 9838f12..81d6c98 100644 --- a/src/application/view/common/footer.phtml +++ b/src/application/view/common/footer.phtml @@ -1,6 +1,7 @@

Open Source web interface to interact Twister Network remotely.'), 'https://github.com/twisterarmy/cloud-server', 'http://twister.net.co') ?>

+

diff --git a/src/bootstrap.php b/src/bootstrap.php index 2d1d67c..803bc98 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -33,7 +33,6 @@ $_modelUser = new ModelUser( DB_PASSWORD ); -/* $_modelBlock = new ModelBlock( DB_DATABASE, DB_HOST, @@ -41,7 +40,6 @@ $_modelBlock = new ModelBlock( DB_USER, DB_PASSWORD ); -*/ // Route if (isset($_GET['_route_'])) {