/** * @see \wcf\system\dashboard\box\AbstractDashboardBoxContent::init() */ public function init(DashboardBox $box, IPage $page) { parent::init($box, $page); // get ids $mostActiveMemberIDs = MostActiveMembersCacheBuilder::getInstance()->getData(); if (!empty($mostActiveMemberIDs)) { // get profile data $this->userProfileList = new UserProfileList(); $this->userProfileList->sqlOrderBy = 'user_table.activityPoints DESC'; $this->userProfileList->setObjectIDs($mostActiveMemberIDs); $this->userProfileList->readObjects(); } $this->fetched(); }
/** * @see \wcf\system\dashboard\box\IDashboardBox::init() */ public function init(DashboardBox $box, IPage $page) { parent::init($box, $page); // get current date $currentDay = DateUtil::format(null, 'm-d'); $date = explode('-', DateUtil::format(null, 'Y-n-j')); // get user ids $userIDs = UserBirthdayCache::getInstance()->getBirthdays($date[1], $date[2]); $userIDs = array_intersect($userIDs, WCF::getUserProfileHandler()->getFollowingUsers()); if (!empty($userIDs)) { $userProfileList = new UserProfileList(); $userProfileList->setObjectIDs($userIDs); $userProfileList->readObjects(); $i = 0; foreach ($userProfileList as $userProfile) { if ($i == 10) { break; } if (!$userProfile->isProtected() && substr($userProfile->birthday, 5) == $currentDay) { $this->userProfiles[] = $userProfile; $i++; } } } $this->fetched(); }
/** * @see \wcf\system\dashboard\box\IDashboardBox::init() */ public function init(DashboardBox $box, IPage $page) { parent::init($box, $page); // get current date $currentDay = DateUtil::format(null, 'm-d'); $date = explode('-', DateUtil::format(null, 'Y-n-j')); // get user ids $userIDs = UserBirthdayCache::getInstance()->getBirthdays($date[1], $date[2]); if (!empty($userIDs)) { $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); if (isset($userOptions['birthday'])) { $birthdayUserOption = $userOptions['birthday']; $userProfileList = new UserProfileList(); $userProfileList->setObjectIDs($userIDs); $userProfileList->readObjects(); $i = 0; foreach ($userProfileList as $userProfile) { if ($i == 10) { break; } $birthdayUserOption->setUser($userProfile->getDecoratedObject()); if (!$userProfile->isProtected() && $birthdayUserOption->isVisible() && substr($userProfile->birthday, 5) == $currentDay) { $this->userProfiles[] = $userProfile; $i++; } } } } $this->fetched(); }
/** * @see \wcf\data\IGroupedUserListAction::getGroupedUserList() */ public function getGroupedUserList() { $year = $month = $day = 0; $value = explode('-', $this->parameters['date']); if (isset($value[0])) { $year = intval($value[0]); } if (isset($value[1])) { $month = intval($value[1]); } if (isset($value[2])) { $day = intval($value[2]); } // get users $users = array(); $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); if (isset($userOptions['birthday'])) { $birthdayUserOption = $userOptions['birthday']; $userIDs = UserBirthdayCache::getInstance()->getBirthdays($month, $day); $userList = new UserProfileList(); $userList->setObjectIDs($userIDs); $userList->readObjects(); foreach ($userList->getObjects() as $user) { $birthdayUserOption->setUser($user->getDecoratedObject()); if (!$user->isProtected() && $birthdayUserOption->isVisible() && $user->getAge($year) >= 0) { $users[] = $user; } } } WCF::getTPL()->assign(array('users' => $users, 'year' => $year)); return array('pageCount' => 1, 'template' => WCF::getTPL()->fetch('userBirthdayList')); }
/** * Returns a list of user profiles. * * @param array $userIDs * @return array<\wcf\data\user\UserProfile> */ public static function getUserProfiles(array $userIDs) { $users = array(); // check cache foreach ($userIDs as $index => $userID) { if (isset(self::$userProfiles[$userID])) { $users[$userID] = self::$userProfiles[$userID]; unset($userIDs[$index]); } } if (!empty($userIDs)) { $userList = new UserProfileList(); $userList->setObjectIDs($userIDs); $userList->readObjects(); foreach ($userList as $user) { $users[$user->userID] = $user; self::$userProfiles[$user->userID] = $user; } } return $users; }