/**
  * @see ContestNotificationInterface::getRecipients()
  */
 public function getRecipients()
 {
     // TODO: read all contest solutions which do not have price yet, and where the prices did not expire
     return;
     $ids = array();
     require_once WCF_DIR . 'lib/data/contest/solution/ContestSolution.class.php';
     $winners = ContestSolution::getWinners($this->contestID);
     foreach ($winners as $solution) {
         if ($solution->hasPrice() == false) {
             if ($solution->isPriceExpired() && $solution->isOwner() == false) {
                 continue;
             }
             $ids = array_merge($ids, $this->getInstance()->getOwner()->getUserIDs());
         }
     }
     return array_unique($ids);
 }
 /**
  * by which solution/winner is this price pickable
  *
  * @return 	ContestSolution|null		$solution
  */
 public function pickableByWinner()
 {
     if (WCF::getUser()->userID == 0 || $this->hasWinner()) {
         return null;
     }
     $contest = Contest::getInstance($this->contestID);
     if ($contest->state != 'closed') {
         return null;
     }
     require_once WCF_DIR . 'lib/data/contest/solution/ContestSolution.class.php';
     $winners = ContestSolution::getWinners($this->contestID);
     foreach ($winners as $solution) {
         if ($solution->hasPrice() == false) {
             if ($solution->pickTime < TIME_NOW && $solution->isOwner() == false) {
                 continue;
             }
             return $solution->isOwner() ? $solution : null;
         }
     }
     return null;
 }
    /**
     * if priceExpireSeconds is set, the solution will have a maximum time to choose a price
     * if no price is chosen in this period, the next winner can take a price
     */
    public function updatePickTimes()
    {
        require_once WCF_DIR . 'lib/data/contest/solution/ContestSolution.class.php';
        // get first + latest pick
        $firstPick = $lastPick = 0;
        // update cache
        ContestSolution::resetWinners($this->contestID);
        foreach (ContestSolution::getWinners($this->contestID) as $solution) {
            if ($solution->hasPrice()) {
                $lastPick = max($lastPick, $solution->pickTime);
            } else {
                $firstPick = min($firstPick, $solution->pickTime);
            }
        }
        $timestamp = 0;
        // first run? then start from the current date
        if ($firstPick == 0) {
            $firstPick = TIME_NOW;
        }
        // no price was picked yet, so start from the beginning
        if ($lastPick == 0) {
            $timestamp = $firstPick;
        } else {
            $timestamp = $lastPick;
        }
        $nextSolution = null;
        foreach (ContestSolution::getWinners($this->contestID) as $solution) {
            // contest already has price?
            // pick time has passed since the winner did not choose a price in time
            if ($solution->hasPrice() || $solution->pickTime && $solution->pickTime < TIME_NOW) {
                continue;
            }
            // remember first valid solution
            if ($nextSolution === null) {
                $nextSolution = $solution;
            }
            // no change, skip database update
            $save = $this->priceExpireSeconds == 0 ? 0 : $timestamp;
            // user will have xx hours from now on
            $timestamp += $this->priceExpireSeconds;
            // database update, if needed
            if ($solution->pickTime != $save) {
                $solution->getEditor()->updatePickTime($save);
            }
        }
        // notify next winner
        if ($nextSolution) {
            // use notification api
            if (false) {
                require_once WCF_DIR . 'lib/data/contest/event/ContestEventEditor.class.php';
                $owner = $nextSolution->getOwner();
                ContestEventEditor::create($contestID, $owner->userID, $owner->groupID, 'ContestPriceExpire', array('priceID' => $priceID, 'owner' => $owner->getName()));
            }
            // use mail if participant is single user
            // TODO: remove after notification api is implemented
            // TODO: missing translation
            if ($nextSolution->getOwner()->userID) {
                $mail = new Mail($nextSolution->getOwner()->email, 'easy-coding Gewinnspiel - du hast gewonnen', 'Hallo ' . $nextSolution->getOwner()->getName() . ',
du gehörst zu den glücklichen Gewinnern beim easy-coding Gewinnspiel.
Bitte suche dir innerhalb von 24h auf folgender Seite einen Preis aus: ' . PAGE_URL . '/index.php?page=ContestPrice&contestID=' . $this->contestID . '

Vielen Dank für die Teilnahme beim Gewinnspiel,

Torben Brodt');
                $mail->addBCC(MAIL_ADMIN_ADDRESS);
                $mail->send();
            }
        }
        return $nextSolution;
    }