当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayData::getField方法代码示例

本文整理汇总了PHP中ArrayData::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayData::getField方法的具体用法?PHP ArrayData::getField怎么用?PHP ArrayData::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayData的用法示例。


在下文中一共展示了ArrayData::getField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetField

 function testSetField()
 {
     $arrayData = new ArrayData(array());
     $arrayData->setField('d', 'Delta');
     $this->assertTrue($arrayData->hasField('d'));
     $this->assertEquals('Delta', $arrayData->getField('d'));
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: view

 public function view(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $game_id = $params['ID'];
     $game = Game::get()->filter('ID', $game_id)->first();
     $teams = $game->Teams();
     $allTeams = array();
     foreach ($teams as $team) {
         $teamArr = array();
         $player_one = Player::get()->filter('ID', $team->PlayerOne)->first();
         $player_two = Player::get()->filter('ID', $team->PlayerTwo)->first();
         $teamArr['Names'] = $player_one->Name . ' & ' . $player_two->Name;
         $teamArr['GamesPlayed'] = $team->getGamesPlayed();
         $teamArr['TeamID'] = $team->ID;
         if ($allTeams == array()) {
             $allTeams['TeamOne'] = $teamArr;
         } else {
             $allTeams['TeamTwo'] = $teamArr;
         }
     }
     $link = $this->Link();
     $data = new ArrayData(array('Teams' => $allTeams, 'ParentLink' => $link, 'Winner' => $game->Winner, 'Score' => $game->ScoreTeamOne . '-' . $game->ScoreTeamTwo));
     if ($data->getField('Teams') == array()) {
         $data = new ArrayData(array('Content' => 'There are no teams assigned to this game.', 'AddNewTeam' => '<a href="' . $link . 'assignteams/' . $game_id . '" class="btn btn-success">Assign a Team to this game</a>', 'ParentLink' => $this->Link()));
         Session::set('GameID', $game_id);
     }
     return $data->renderWith(array('Game', 'Page'));
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:28,代码来源:GamesPage.php


注:本文中的ArrayData::getField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。