Pommo_Subscribers::tally PHP Method

tally() static public method

returns subscriber tally (int)
static public tally ( $status = 1 )
    static function tally($status = 1)
    {
        $dbo = Pommo::$_dbo;
        if ($status === 'all') {
            $status = null;
        }
        $query = "\n            SELECT count(subscriber_id)\n            FROM " . $dbo->table['subscribers'] . "\n            [WHERE status=%I]";
        $query = $dbo->prepare($query, array($status));
        return $dbo->query($query, 0);
    }

Usage Example

コード例 #1
0
ファイル: Pommo_Groups.php プロジェクト: soonick/poMMo
 function __construct($groupID = NULL, $status = 1, $filter = FALSE)
 {
     $this->_status = $status;
     if (!is_numeric($groupID)) {
         // exception if no group ID was passed -- group assumes "all subscribers".
         require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
         $this->_group = array('rules' => array(), 'id' => 0);
         $this->_id = 0;
         $this->_name = Pommo::_T('All Subscribers');
         $this->_memberIDs = is_array($filter) ? Pommo_Groups::getMemberIDs($this->_group, $status, $filter) : null;
         $this->_tally = is_array($filter) ? count($this->_memberIDs) : Pommo_Subscribers::tally($status);
         return;
     }
     $this->_group = current(Pommo_Groups::get(array('id' => $groupID)));
     $this->_id = $groupID;
     $this->_name =& $this->_group['name'];
     $this->_memberIDs = Pommo_Groups::getMemberIDs($this->_group, $status, $filter);
     $this->_tally = count($this->_memberIDs);
     return;
 }