added online users feature

This commit is contained in:
SJ
2013-07-24 22:14:05 +02:00
parent 920f4208ba
commit 93e9c7ce33
16 changed files with 159 additions and 1 deletions

View File

@ -18,6 +18,9 @@ class ControllerHealthWorker extends Controller {
$this->load->model('health/health');
$this->load->model('stat/counter');
if(ENABLE_SAAS == 1) {
$this->load->model('saas/customer');
}
$request = Registry::get('request');
@ -37,6 +40,9 @@ class ControllerHealthWorker extends Controller {
$this->data['health'][] = $this->model_health_health->checksmtp($smtp, $lang->data['text_error']);
}
if(ENABLE_SAAS == 1) {
$this->data['num_of_online_users'] = $this->model_saas_customer->count_online();
}
$this->data['processed_emails'] = $this->model_health_health->count_processed_emails();

View File

@ -29,6 +29,7 @@ class ControllerLoginLogin extends Controller {
if(ENABLE_SAAS == 1) {
$this->load->model('saas/ldap');
$this->load->model('saas/customer');
}
$this->document->title = $this->data['text_login'];
@ -39,6 +40,10 @@ class ControllerLoginLogin extends Controller {
$this->model_user_prefs->get_user_preferences($_SESSION['username']);
if(ENABLE_SAAS == 1) {
$this->model_saas_customer->online($_SESSION['username']);
}
LOGGER('logged in');
if(isAdminUser() == 1) {

View File

@ -18,6 +18,11 @@ class ControllerLoginLogout extends Controller {
$this->document->title = $this->data['text_logout'];
if(ENABLE_SAAS == 1) {
$this->load->model('saas/customer');
$this->model_saas_customer->offline(Registry::get('username'));
}
logout();
$this->render();

View File

@ -0,0 +1,33 @@
<?php
class ControllerStatOnline extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "stat/online.tpl";
$this->layout = "common/layout";
$request = Registry::get('request');
$db = Registry::get('db');
$this->load->model('saas/customer');
$this->document->title = $this->data['text_statistics'];
if(Registry::get('admin_user') == 0) {
die("go away");
}
$this->data['users'] = $this->model_saas_customer->get_online_users();
$this->render();
}
}
?>