當前位置: 首頁>>代碼示例>>PHP>>正文


PHP State::getAllStates方法代碼示例

本文整理匯總了PHP中State::getAllStates方法的典型用法代碼示例。如果您正苦於以下問題:PHP State::getAllStates方法的具體用法?PHP State::getAllStates怎麽用?PHP State::getAllStates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在State的用法示例。


在下文中一共展示了State::getAllStates方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: displayClueEditForm

function displayClueEditForm(Clue $clue)
{
    $dateSelect = ui_select('date', Date::getAllDates(), $clue->getFormDate());
    $defaultStateSelect = ui_select('defaultState', State::getAllStates(), $clue->getDefaultState());
    $startDateSelect = ui_select("startDate", Date::getAllDatesNullable(), $clue->getStartFormDate());
    $hintDateSelect = ui_select("hintDate", Date::getAllDatesNullable(), $clue->getHintFormDate());
    $answerDateSelect = ui_select("answerDate", Date::getAllDatesNullable(), $clue->getAnswerFormDate());
    $startCitySelect = ui_select("startCity", City::getAllCityNames(), $clue->getStartCityID());
    $hintCitySelect = ui_select("hintCity", City::getAllCityNames(), $clue->getHintCityID());
    $answerCitySelect = ui_select("answerCity", City::getAllCityNames(), $clue->getAnswerCityID());
    $startDirectionSelect = ui_select("startDirection", Direction::getAllDirections(), $clue->getStartDirection());
    $hintDirectionSelect = ui_select("hintDirection", Direction::getAllDirections(), $clue->getHintDirection());
    $answerDirectionSelect = ui_select("answerDirection", Direction::getAllDirections(), $clue->getAnswerDirection());
    return <<<EOT
<form method="POST" action="clues.php">
Name (admin use only): <input type="hidden" name="id" value="{$clue->getID()}" />
<input type="text" name="name" value="{$clue->getName()}" />
<br />
Date (for sorting): {$dateSelect}
<input type="text" size="8" name="time" value="{$clue->getFormTime()}" />
<br />
Default state: {$defaultStateSelect}
<br />
Question: <br />
<textarea name="question" cols="45" rows="8">{$clue->getQuestion()}</textarea><br />
Hint: <br />
<textarea name="hint" cols="45" rows="4">{$clue->getHint()}</textarea><br />
Answers (1 per line, * for wildcard): <br />
<textarea name="answer" cols="45" rows="4">{$clue->getAnswerText()}</textarea><br />
<br /><br />

Answering prerequisites:<br />
<input type="text" size="4" name="startDistance" value="{$clue->getStartDistance()}" />
miles {$startDirectionSelect} {$startCitySelect} or after time
{$startDateSelect} <input type="text" size="8" name="startTime" value="{$clue->getStartFormTime()}" />.<br /><br />

Hint conditions:<br />
<input type="text" size="4" name="hintDistance" value="{$clue->getHintDistance()}" />
miles {$hintDirectionSelect} {$hintCitySelect} or after time
{$hintDateSelect} <input type="text" size="8" name="hintTime" value="{$clue->getHintFormTime()}" />.<br /><br />

Auto-answering conditions:<br />
<input type="text" size="4" name="answerDistance" value="{$clue->getAnswerDistance()}" />
miles {$answerDirectionSelect} {$answerCitySelect} or after time
{$answerDateSelect} <input type="text" size="8" name="answerTime" value="{$clue->getAnswerFormTime()}" />.<br /><br />


<input type="submit" name="edit" value="Edit Clue" />
<br /><br />
Delete clue: <input type="submit" name="delete" value="Delete Clue" />
</form>
EOT;
}
開發者ID:rjwalsh88,項目名稱:BawkApp,代碼行數:53,代碼來源:clues.php

示例2: getHistogram

 public function getHistogram()
 {
     $clueStates = $this->getClueStates();
     $teams = Team::getAllTeams();
     if (count($clueStates) == 0) {
         return "<span style=\"font-size: 12px;\"><b>All hidden</b></span>";
     }
     $counts = array(0, 0, 0, 0, 0);
     foreach ($teams as $team) {
         $clueState = $this->getClueState($team);
         $state = $clueState ? $clueState->getState() : STATE_HIDDEN;
         $counts[$state]++;
     }
     if ($counts[STATE_ANSWERED] == count($teams)) {
         return "<span style=\"font-size: 12px;\"><b>All answered</b></span>";
     }
     $text = '';
     foreach (State::getAllStates() as $key => $value) {
         if ($text != '') {
             $text .= ', ';
         }
         $text .= "<b>" . $counts[$key] . "</b> " . $value;
     }
     return '<span style="font-size: 12px;">' . $text . "</span>";
 }
開發者ID:rjwalsh88,項目名稱:BawkApp,代碼行數:25,代碼來源:Clue.php


注:本文中的State::getAllStates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。