updating number of current users via notifications

This commit is contained in:
Ralf Becker 2011-04-14 09:50:35 +00:00
parent 23c21cb372
commit 42bf4dbc3c
2 changed files with 14 additions and 7 deletions

View File

@ -52,7 +52,7 @@ class notifications_ajax {
/** /**
* reference to global db object * reference to global db object
* *
* @var db * @var egw_db
*/ */
private $db; private $db;
@ -75,7 +75,7 @@ class notifications_ajax {
/** /**
* the xml response object * the xml response object
* *
* @var response * @var xajaxResponse
*/ */
private $response; private $response;
@ -87,8 +87,7 @@ class notifications_ajax {
$this->response = new xajaxResponse(); $this->response = new xajaxResponse();
$this->recipient = (object)$GLOBALS['egw']->accounts->read(); $this->recipient = (object)$GLOBALS['egw']->accounts->read();
$config = new config(self::_appname); $this->config = (object)config::read(self::_appname);
$this->config = (object)$config->read_repository();
$prefs = new preferences($this->recipient->account_id); $prefs = new preferences($this->recipient->account_id);
$preferences = $prefs->read(); $preferences = $prefs->read();
@ -113,6 +112,14 @@ class notifications_ajax {
*/ */
public function get_notifications() { public function get_notifications() {
if ($GLOBALS['egw_info']['user']['apps']['felamimail']) $this->check_mailbox(); if ($GLOBALS['egw_info']['user']['apps']['felamimail']) $this->check_mailbox();
// update currentusers
if ($GLOBALS['egw_info']['user']['apps']['admin'] &&
$GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers'])
{
$this->response->assign('currentusers', 'innerText', $GLOBALS['egw']->session->session_count());
}
$this->get_egwpopup(); $this->get_egwpopup();
return $this->response->getXML(); return $this->response->getXML();
@ -123,7 +130,7 @@ class notifications_ajax {
* After they've seen it, remove it from the database * After they've seen it, remove it from the database
*/ */
public function confirm_message($message) { public function confirm_message($message) {
error_log( html_entity_decode($message)); //error_log( html_entity_decode($message));
$myval=$this->db->delete(self::_notification_table,array( $myval=$this->db->delete(self::_notification_table,array(
'account_id' => $this->recipient->account_id, 'account_id' => $this->recipient->account_id,
'message' => html_entity_decode($message) 'message' => html_entity_decode($message)

View File

@ -440,7 +440,7 @@ abstract class egw_framework
if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers'])
{ {
$current_users = '<a href="' . egw::link('/index.php','menuaction=admin.admin_accesslog.sessions') . '">' . $current_users = '<a href="' . egw::link('/index.php','menuaction=admin.admin_accesslog.sessions') . '">' .
lang('Current users') . ': ' . $GLOBALS['egw']->session->session_count() . '</a>'; lang('Current users') . ': <span id="currentusers">' . $GLOBALS['egw']->session->session_count() . '</span></a>';
return $current_users; return $current_users;
} }
} }