Exemplo n.º 1
0
 /**
  * get's callend then online user does a pageview
  *
  * @param array $params            
  */
 public function onlineUserPageViewLogged($params)
 {
     if ($this->settings['enabled'] == true && $this->settings['online_visitors_tracking'] == true) {
         $onlineOptions = erLhcoreClassModelChatConfig::fetch('xmppservice_options')->data;
         if (isset($onlineOptions['track_online']) && $onlineOptions['track_online'] == true) {
             if (($xmppAccount = erLhcoreClassModelXMPPAccount::findOne(array('filter' => array('type' => erLhcoreClassModelXMPPAccount::USER_TYPE_VISITOR, 'user_id' => $params['ou']->id)))) !== false) {
                 if ($this->settings['handler'] == 'rpc' && is_object($params['tpl']) && $this->settings['online_visitors_tracking'] == true) {
                     /**
                      * In the future then websockets will support attatch method this could be used
                      * */
                     /* $xmppAccount->attach_data = erLhcoreClassExtensionXmppserviceHandler::prebindSession(array(
                            'username' => $xmppAccount->username,
                            'password' => $xmppAccount->password,
                            'host' => $this->settings['prebind_host'] . $xmppAccount->username_plain,
                        )); */
                     $params['tpl']->set('xmppAccount', $xmppAccount);
                 }
                 // Forward this information to NodeJS server
                 erLhcoreClassExtensionXmppserviceHandler::onlineUserPageViewLogged(array('xmpp_account' => $xmppAccount, 'ou' => $params['ou'], 'host_login' => $this->settings['host_login'], 'node_api_server' => $this->settings['node_api_server'], 'handler' => $this->settings['handler'], 'xmpp_host' => $this->settings['xmpp_host'], 'rpc_server' => $this->settings['rpc_server'], 'rpc_username' => $this->settings['rpc_username'], 'rpc_password' => $this->settings['rpc_password'], 'rpc_account_host' => $this->settings['rpc_account_host']));
             }
         }
     }
 }