コード例 #1
0
ファイル: clues.php プロジェクト: rjwalsh88/BawkApp
function displayPastClue(Clue $clue, $team, $clueState = STATE_UNLOCKED)
{
    $text = $clue->getQuestion();
    $clueState = $team ? $clue->getClueState($team) : null;
    $answerText = $clueState ? $clueState->getAnswer() : null;
    $answerTime = $clueState ? $clueState->getTime() : null;
    $answerText = $answerText ? $answerText : '(Out of time!)';
    $answer = "<br /><i>Your Answer:</i> {$answerText} (at {$answerTime})";
    return $text . $answer . '<br /><br />';
}
コード例 #2
0
ファイル: Team.php プロジェクト: rjwalsh88/BawkApp
 public function doGuessAnswer(Clue $clue, $guess)
 {
     $clueState = $clue->getClueState($this);
     $currentState = $clue->calculateClueState($this);
     if ($currentState >= STATE_ANSWERED) {
         add_notification('This clue has already been answered.');
         return false;
     } else {
         if ($currentState < STATE_ANSWERABLE) {
             add_notification('This clue cannot be answered yet. Try waiting or changing your location as indicated.');
             return false;
         }
     }
     if ($clue->isGuessCorrect($guess)) {
         add_notification('Correct answer!');
         if ($clueState == null) {
             $clueState = new ClueState(array('team' => $this->id, 'clue' => $clue->getID()));
             $clueState->doAdd();
             $clue->setClueState($this, $clueState);
         }
         $clueState->makeChanges(array('state' => STATE_ANSWERED, 'answer' => $guess));
         $clueState->doUpdate();
         return true;
     } else {
         add_notification('Incorrect guess!');
         return false;
     }
 }