|
|
- <?php
- /**
- * @package uForum2
- * @file inc/models/StatisticsModel.php
- * @copyright 2007-2015 (c) PioDer
- * @link http://www.pioder.pl/
- * @license see LICENSE.txt
- **/
-
- class StatisticsModel extends Model
- {
- private $logged_users = null;
-
- public function getPostsCount()
- {
- $out = $this->select(POSTS_TABLE, 'count(post_id) AS posts_count');
- return $out[0]['posts_count'];
- }
-
- public function getTopicsCount()
- {
- $out = $this->select(TOPICS_TABLE, 'count(topic_id) AS topics_count');
- return $out[0]['topics_count'];
- }
-
- public function getUsersCount()
- {
- $out = $this->select(USERS_TABLE, 'count(user_id) AS users_count');
- return $out[0]['users_count'];
- }
-
- public function getLastRegisteredUser()
- {
- $out = $this->select(USERS_TABLE, 'user_id, nick, rank', '', 'user_id DESC', '1');
- return $out[0];
- }
-
- private function retrieveLoggedUsers()
- {
- if ($this->logged_users == null)
- {
- $this->logged_users = $this->select(LOGGED_USERS_VIEW);
- }
- }
-
- public function getLoggedUsersCount()
- {
- $this->retrieveLoggedUsers();
-
- return count($this->logged_users);
- }
-
- public function getLoggedUsers()
- {
- $this->retrieveLoggedUsers();
-
- return $this->logged_users;
- }
- }
- ?>
|