/**
  * @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\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\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'));
 }
 /**
  * @see	\wcf\system\condition\IContentCondition::showContent()
  */
 public function showContent(Condition $condition)
 {
     if (!WCF::getUser()->userID) {
         return false;
     }
     $dateTime = new \DateTime();
     $dateTime->setTimezone(WCF::getUser()->getTimeZone());
     $userIDs = UserBirthdayCache::getInstance()->getBirthdays($dateTime->format('n'), $dateTime->format('j'));
     return in_array(WCF::getUser()->userID, $userIDs);
 }