From d352adf6f6a182f91537796d4bc4923131a05250 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 13 May 2013 14:56:58 +0200 Subject: [PATCH] adding method to fetch all active worker count --- public/include/classes/worker.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index 94c4013f..55701be2 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -57,6 +57,20 @@ class Worker { } return false; } + + public function getCountAllActiveWorkers() { + $stmt = $this->mysqli->prepare("SELECT count(id) AS total FROM $this->table WHERE active = 1"); + if ($this->checkStmt($stmt)) { + if (!$stmt->execute()) { + return false; + } + $result = $stmt->get_result(); + $stmt->close(); + return $result->fetch_object()->total; + } + return false; + } + public function addWorker($account_id, $workerName, $workerPassword) { $username = $this->user->getUserName($account_id); $workerName = "$username.$workerName";