当前位置: 首页>>代码示例>>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;未经允许,请勿转载。