示例#1
0
 /**
  * get user objs
  *
  * @param  Mixed  $var
  * @param  Array  $mbqOpt
  * $mbqOpt['case'] = 'byUserIds' means get data by user ids.$var is the ids.
  * @mbqOpt['case'] = 'online' means get online user.
  * @return  Array
  */
 public function getObjsMbqEtUser($var, $mbqOpt)
 {
     if ($mbqOpt['case'] == 'byUserIds') {
         $objsUserProfile = UserProfile::getUserProfiles($var);
         $objsMbqEtUser = array();
         foreach ($objsUserProfile as $oUserProfile) {
             $objsMbqEtUser[] = $this->initOMbqEtUser($oUserProfile, array('case' => 'oUserProfile'));
         }
         return $objsMbqEtUser;
     } elseif ($mbqOpt['case'] == 'online') {
         //ref wbb\page\BoardListPage::readData(),wcf\data\user\online\UsersOnlineList,MbqRdEtSysStatistics::initOMbqEtSysStatistics()
         if (MODULE_USERS_ONLINE && WBB_INDEX_ENABLE_ONLINE_LIST) {
             $usersOnlineList = new UsersOnlineList();
             $usersOnlineList->readStats();
             $usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
             $usersOnlineList->readObjects();
             // check users online record
             $usersOnlineTotal = WBB_USERS_ONLINE_RECORD_NO_GUESTS ? $usersOnlineList->stats['members'] : $usersOnlineList->stats['total'];
             if ($usersOnlineTotal > WBB_USERS_ONLINE_RECORD) {
                 // save new record
                 $optionAction = new OptionAction(array(), 'import', array('data' => array('wbb_users_online_record' => $usersOnlineTotal, 'wbb_users_online_record_time' => TIME_NOW)));
                 $optionAction->executeAction();
             }
             $ids = array();
             foreach ($usersOnlineList->getObjects() as $oUserOnline) {
                 $ids[] = $oUserOnline->getDecoratedObject()->userID;
             }
             return $this->getObjsMbqEtUser($ids, array('case' => 'byUserIds'));
         } else {
             return array();
         }
     }
     MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_UNKNOWN_CASE);
 }
示例#2
0
 /**
  * init system statistics by condition
  *
  * @return  Object
  */
 public function initOMbqEtSysStatistics()
 {
     $oMbqEtSysStatistics = MbqMain::$oClk->newObj('MbqEtSysStatistics');
     //ref wbb\page\BoardListPage::readData(),wcf\data\user\online\UsersOnlineList
     if (MODULE_USERS_ONLINE && WBB_INDEX_ENABLE_ONLINE_LIST) {
         $usersOnlineList = new UsersOnlineList();
         $usersOnlineList->readStats();
         $usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $usersOnlineList->readObjects();
         // check users online record
         $usersOnlineTotal = WBB_USERS_ONLINE_RECORD_NO_GUESTS ? $usersOnlineList->stats['members'] : $usersOnlineList->stats['total'];
         if ($usersOnlineTotal > WBB_USERS_ONLINE_RECORD) {
             // save new record
             $optionAction = new OptionAction(array(), 'import', array('data' => array('wbb_users_online_record' => $usersOnlineTotal, 'wbb_users_online_record_time' => TIME_NOW)));
             $optionAction->executeAction();
         }
         $oMbqEtSysStatistics->forumTotalOnline->setOriValue($usersOnlineList->stats['total']);
         $oMbqEtSysStatistics->forumGuestOnline->setOriValue($usersOnlineList->stats['guests']);
     } else {
         $oMbqEtSysStatistics->forumTotalOnline->setOriValue(0);
         $oMbqEtSysStatistics->forumGuestOnline->setOriValue(0);
     }
     return $oMbqEtSysStatistics;
 }
示例#3
0
 /**
  * Checks the users online record.
  */
 public function checkRecord()
 {
     $usersOnlineTotal = USERS_ONLINE_RECORD_NO_GUESTS ? $this->stats['members'] : $this->stats['total'];
     if ($usersOnlineTotal > USERS_ONLINE_RECORD) {
         // save new record
         $optionAction = new OptionAction(array(), 'import', array('data' => array('users_online_record' => $usersOnlineTotal, 'users_online_record_time' => TIME_NOW)));
         $optionAction->executeAction();
     }
 }