Просмотр файла siwap.ru/system/classes/Statistic.class.php

Размер файла: 1.83Kb
<?php

class Statistic {
    
    public function Users($type = 1)
    {
        $count = 0;
        
        if($type == 1)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `user`');
        }
        else if($type == 2)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `user` WHERE `date_reg` > :time', [
               'time' => (TIME-300),
            ]);
        }
        else if($type == 3)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `user` WHERE `date_reg` > :time', [
               'time' => (TIME - 60 * 60 * 24),
            ]);
        }
        return $count;
    }
    
    public function Albums($type)
    {
        $count = 0;
        
        if($type == 1)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `albums`');
        }
        else if($type == 2)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `albums` WHERE `time` > :time', [
               'time' => (TIME-300),
            ]);
        }
        else if($type == 3)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `albums` WHERE `time` > :time', [
               'time' => (TIME - 60 * 60 * 24),
            ]);
        }
        return $count;
    }
    
    public function Photos($type)
    {
        $count = 0;
        
        if($type == 1)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `photos`');
        }
        else if($type == 2)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `photos` WHERE `time` > :time', [
               'time' => (TIME-300),
            ]);
        }
        else if($type == 3)
        {
            $count = Base::query('SELECT COUNT(`id`) FROM `photos` WHERE `time` > :time', [
               'time' => (TIME - 60 * 60 * 24),
            ]);
        }
        return $count;
    }
}

?>