54 lines
1014 B
PHP
54 lines
1014 B
PHP
|
<?php
|
||
|
/**
|
||
|
* Created by PhpStorm.
|
||
|
* User: Li Jianxuan
|
||
|
* Date: 14-9-19
|
||
|
* Time: 下午3:21
|
||
|
*/
|
||
|
|
||
|
namespace Westdc\User;
|
||
|
|
||
|
use Zend\ServiceManager\ServiceManager;
|
||
|
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
||
|
|
||
|
class Status implements ServiceManagerAwareInterface{
|
||
|
|
||
|
protected $serviceManager;
|
||
|
|
||
|
private $db;
|
||
|
|
||
|
public function setServiceManager(ServiceManager $serviceManager)
|
||
|
{
|
||
|
$this->serviceManager = $serviceManager;
|
||
|
|
||
|
$this->init();
|
||
|
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
private function init()
|
||
|
{
|
||
|
$dbService = $this->serviceManager->get('Db');
|
||
|
$this->db = $dbService->getPdo();
|
||
|
}
|
||
|
|
||
|
|
||
|
public function getUserCount(){
|
||
|
|
||
|
$sql="select count(id) as total from users";
|
||
|
$uq=$this->db->query($sql);
|
||
|
|
||
|
return $uq->fetchColumn(0);
|
||
|
|
||
|
}
|
||
|
|
||
|
public function getAdminCount(){
|
||
|
|
||
|
$sql="select count(id) as total from users where usertype='administrator'";
|
||
|
$uq=$this->db->query($sql);
|
||
|
|
||
|
return $uq->fetchColumn(0);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|