/**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     if (MODULE_USERS_ONLINE) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IN (SELECT userID FROM wcf' . WCF_N . '_user_to_group WHERE groupID IN (SELECT groupID FROM wcf' . WCF_N . '_user_group WHERE showOnTeamPage = ?))', array(1));
         $this->usersOnlineList->readObjects();
     }
     $this->fetched();
 }
 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     if (MODULE_USERS_ONLINE && WCF::getSession()->getPermission('user.profile.canViewUsersOnlineList') && count(WCF::getUserProfileHandler()->getFollowingUsers())) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IN (?)', array(WCF::getUserProfileHandler()->getFollowingUsers()));
         $this->usersOnlineList->sqlLimit = 10;
         $this->usersOnlineList->readObjects();
     }
     $this->fetched();
 }
 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     if (MODULE_USERS_ONLINE && WCF::getSession()->getPermission('user.profile.canViewUsersOnlineList')) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->checkRecord();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     $this->fetched();
 }
예제 #4
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);
 }
예제 #5
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;
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // categories
     $categoryTree = new NewsCategoryNodeTree($this->objectTypeName);
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // stats
     $this->stats = NewsStatsCacheBuilder::getInstance()->getData();
     $this->stats['categories'] = count(CategoryHandler::getInstance()->getCategories($this->objectTypeName));
     $this->stats['comments'] = count(CommentHandler::getInstance()->getObjectType('de.voolia.news.comment'));
     // users online list
     if (MODULE_USERS_ONLINE && NEWS_INDEX_ENABLE_USERS_ONLINE_LIST) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     // add breadcrumbs
     NEWSCore::getInstance()->setBreadcrumbs($this->category !== null ? $this->category->getParentCategories() : array());
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // categories
     $categoryTree = new NewsCategoryNodeTree($this->objectTypeName);
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // stats
     $this->stats = NewsStatsCacheBuilder::getInstance()->getData();
     $this->stats['categories'] = count(CategoryHandler::getInstance()->getCategories($this->objectTypeName));
     $this->stats['comments'] = count(CommentHandler::getInstance()->getObjectType('de.incendium.cms.news.comment'));
     // users online list
     if (MODULE_USERS_ONLINE && CMS_NEWS_ENABLE_USERS_ONLINE_LIST) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     // add breadcrumbs
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news'), LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms'))));
     if ($this->category !== null) {
         foreach ($this->category->getParentCategories() as $parentCategory) {
             WCF::getBreadcrumbs()->add($parentCategory->getBreadcrumb());
         }
     }
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // news stats
     $this->stats = NewsStatsCacheBuilder::getInstance()->getData();
     $this->stats['categories'] = count(CategoryHandler::getInstance()->getCategories('de.voolia.news.category'));
     // categories
     $categoryTree = new NewsCategoryNodeTree('de.voolia.news.category');
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // users online list
     if (MODULE_USERS_ONLINE && NEWS_INDEX_ENABLE_USERS_ONLINE_LIST) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     // add breadcrumbs
     if ($this->category !== null) {
         NEWSCore::getInstance()->setBreadcrumbs($this->category->getParentCategories());
     } else {
         if (PageMenu::getInstance()->getLandingPage()->menuItem == 'news.header.menu.news') {
             // remove default breadcrumb entry and set current page as 'website'
             WCF::getBreadcrumbs()->remove(0);
             // meta tags
             MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'news')), true);
             MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true);
             MetaTagHandler::getInstance()->addTag('og:title', 'og:title', WCF::getLanguage()->get(PAGE_TITLE), true);
             MetaTagHandler::getInstance()->addTag('og:description', 'og:description', WCF::getLanguage()->get(PAGE_DESCRIPTION), true);
             MetaTagHandler::getInstance()->addTag('generator', 'generator', 'voolia News-System');
         }
     }
 }