本文整理汇总了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;
}
示例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>";
}