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


PHP Game::_is_finalized方法代码示例

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


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

示例1: applicable

 function applicable($game, $team_id)
 {
     if (Game::_is_finalized($game) && $game['Game']['type'] == BRACKET_GAME && ($game['Game']['name'] == '1st' || strpos($game['Game']['name'], '-1st') !== false)) {
         if ($game['Game']['home_team'] == $team_id && $game['Game']['home_score'] > $game['Game']['away_score']) {
             return true;
         }
         if ($game['Game']['away_team'] == $team_id && $game['Game']['away_score'] > $game['Game']['home_score']) {
             return true;
         }
     }
     return false;
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:12,代码来源:badge_league_champion.php

示例2: submit_stats

 function submit_stats()
 {
     $id = $this->_arg('game');
     if (!$id) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('game', true)), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $this->Game->contain(array('Division' => array('League' => array('StatType' => array('conditions' => array('StatType.type' => 'entered'))), 'Day'), 'GameSlot' => array('Field' => 'Facility'), 'ScoreEntry', 'ScoreDetail' => array('ScoreDetailStat'), 'HomeTeam', 'AwayTeam'));
     $game = $this->Game->read(null, $id);
     if (!$game) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('game', true)), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $team_id = $this->_arg('team');
     // Allow specified individuals (referees, umpires, volunteers) to submit stats without a team id
     if (!$this->is_volunteer && !$this->is_official && !$team_id && !in_array($game['Division']['id'], $this->UserCache->read('DivisionIDs'))) {
         $this->Session->setFlash(__('You must provide a team ID.', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     if (!League::hasStats($game['Division']['League'])) {
         $this->Session->setFlash(__('That league does not have stat tracking enabled!', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     if ($team_id && $team_id != $game['Game']['home_team'] && $team_id != $game['Game']['away_team']) {
         $this->Session->setFlash(__('That team did not play in that game!', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     if (!Game::_is_finalized($game)) {
         $this->Game->_adjustEntryIndices($game);
         if ($team_id && !array_key_exists($team_id, $game['ScoreEntry'])) {
             $this->Session->setFlash(__('You must submit a score for this game before you can submit stats.', true), 'default', array('class' => 'info'));
             $this->redirect(array('action' => 'submit_score', 'game' => $id, 'team' => $team_id));
         }
     }
     $end_time = strtotime("{$game['GameSlot']['game_date']} {$game['GameSlot']['display_game_end']}") + Configure::read('timezone.adjust') * 60;
     if ($end_time - 60 * 60 > time()) {
         $this->Session->setFlash(__('That game has not yet occurred!', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $this->Configuration->loadAffiliate($game['Division']['League']['affiliate_id']);
     Configure::load("sport/{$game['Division']['League']['sport']}");
     $sport_obj = $this->_getComponent('Sport', $game['Division']['League']['sport'], $this);
     // Remove any empty stats. We DON'T remove '0' stats, as that's still a stat.
     $teams = array_unique(Set::extract('/Stat/team_id', $this->data));
     $entry_stats = Set::extract('/StatType/id', $game['Division']['League']);
     if (!empty($this->data)) {
         $had_data = true;
         foreach ($this->data['Stat'] as $key => $datum) {
             if ($datum['value'] === '' || !in_array($datum['stat_type_id'], $entry_stats)) {
                 unset($this->data['Stat'][$key]);
             }
         }
         // Locate existing records that we want to delete
         $to_delete = $this->Game->Stat->find('list', array('conditions' => array('game_id' => $id, 'team_id' => $teams, 'NOT' => array('id' => Set::extract('/Stat/id', $this->data))), 'contain' => array()));
     }
     if (!empty($to_delete) || !empty($this->data['Stat'])) {
         $transaction = new DatabaseTransaction($this->Game->Stat);
     }
     if (!empty($to_delete)) {
         if (!$this->Game->Stat->deleteAll(array('Stat.id' => $to_delete))) {
             $this->Session->setFlash(sprintf(__('Failed to delete previously saved %s', true), __('stats', true)), 'default', array('class' => 'error'));
             unset($transaction);
         } else {
             // This will be overridden, unless the user erased all previous stats and didn't enter new ones
             $this->Session->setFlash(sprintf(__('The previously saved %s have been removed.', true), __('stats', true)), 'default', array('class' => 'success'));
         }
     }
     if (!empty($this->data['Stat'])) {
         if (isset($transaction)) {
             // Add calculated stats to the array to be saved. We will have deleted any prior calculated stats above.
             $calc_stats = $this->Game->Division->League->StatType->find('all', array('contain' => array(), 'conditions' => array('StatType.type' => 'game_calc', 'StatType.sport' => $game['Division']['League']['sport']), 'fields' => array('id', 'handler')));
             foreach ($calc_stats as $stat_type) {
                 $func = "{$stat_type['StatType']['handler']}_game";
                 if (method_exists($sport_obj, $func)) {
                     $sport_obj->{$func}($stat_type['StatType'], $game, $this->data);
                 } else {
                     trigger_error("Game stat handler {$stat_type['StatType']['handler']} was not found in the {$game['Division']['League']['sport']} component!", E_USER_ERROR);
                 }
             }
             if ($this->Game->Stat->saveAll($this->data['Stat'], array('validate' => 'first'))) {
                 $this->Session->setFlash(sprintf(__('The %s have been saved', true), __('stats', true)), 'default', array('class' => 'success'));
                 $transaction->commit();
                 if ($team_id) {
                     Cache::delete("team/{$team_id}/stats", 'long_term');
                 } else {
                     Cache::delete("team/{$game['Game']['home_team']}/stats", 'long_term');
                     Cache::delete("team/{$game['Game']['away_team']}/stats", 'long_term');
                 }
                 Cache::delete("division/{$game['Division']['id']}/stats", 'long_term');
                 Cache::delete('league/' . $this->Game->Division->league($game['Division']['id']) . '/stats', 'long_term');
                 $this->redirect(array('action' => 'view', 'game' => $id));
             } else {
                 $this->Session->setFlash(sprintf(__('The %s could not be saved. Please correct the errors below and try again.', true), __('stats', true)), 'default', array('class' => 'warning'));
             }
         } else {
             // The deletion above failed, so we don't want to try to save the other data,
             // but let's validate it anyway, in case there's errors we can report.
             $this->Game->Stat->saveAll($this->data['Stat'], array('validate' => 'only'));
         }
     } else {
//.........这里部分代码省略.........
开发者ID:roboshed,项目名称:Zuluru,代码行数:101,代码来源:games_controller.php

示例3: initialize_dependencies

 function initialize_dependencies()
 {
     $id = $this->_arg('division');
     if (!$id) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('division', true)), 'default', array('class' => 'info'));
         $this->redirect(array('controller' => 'leagues', 'action' => 'index'));
     }
     $date = $this->_arg('date');
     $pool = $this->_arg('pool');
     $this->Division->contain(array('Day' => array('order' => 'day_id'), 'Team' => array('Franchise'), 'League', 'Game' => array('GameSlot', 'HomePoolTeam' => array('Pool', 'DependencyPool'), 'AwayPoolTeam' => array('Pool', 'DependencyPool'), 'conditions' => array('NOT' => array('Game.status' => Configure::read('unplayed_status'))), 'order' => 'Game.id')));
     $division = $this->Division->read(null, $id);
     if (!$division) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('division', true)), 'default', array('class' => 'info'));
         $this->redirect(array('controller' => 'leagues', 'action' => 'index'));
     }
     $this->Configuration->loadAffiliate($division['League']['affiliate_id']);
     $conditions = array('Game.division_id' => $id, 'Game.type !=' => SEASON_GAME, 'Game.approved_by' => null, 'OR' => array('HomePoolTeam.dependency_type' => array('seed', 'pool', 'ordinal', 'copy'), 'AwayPoolTeam.dependency_type' => array('seed', 'pool', 'ordinal', 'copy')));
     // If there are tournament pools with finalized games in them, we do not want to
     // initialize any games in those pools.
     $finalized_pools = array_unique(Set::extract('/Game[approved_by!=][pool_id!=]/pool_id', $division));
     if (!empty($finalized_pools)) {
         $conditions['NOT'] = array('Game.pool_id' => $finalized_pools);
     }
     if ($pool) {
         if (in_array($pool, $finalized_pools)) {
             $this->Session->setFlash(__('There are already games finalized in this pool. Unable to proceed.', true), 'default', array('class' => 'warning'));
             $this->redirect(array('action' => 'schedule', 'division' => $id));
         }
         $conditions['Game.pool_id'] = $pool;
     }
     $games = $this->Division->Game->find('all', array('contain' => array('HomePoolTeam', 'AwayPoolTeam', 'GameSlot'), 'conditions' => $conditions));
     if ($date) {
         $multi_day = $division['Division']['schedule_type'] != 'tournament' && count($division['Day']) > 1;
         if ($multi_day) {
             $first_day = Configure::read('organization.first_day');
             $offset = (6 + $first_day - date('N', strtotime($date))) % 7;
             $end = date('Y-m-d', strtotime($date) + $offset * DAY);
             $games = Set::extract("/GameSlot[game_date>={$date}][game_date<={$end}]/..", $games);
         } else {
             $games = Set::extract("/GameSlot[game_date={$date}]/..", $games);
         }
     }
     if (empty($games)) {
         $this->Session->setFlash(__('There are currently no dependencies to initialize in this division.', true), 'default', array('class' => 'warning'));
         $this->redirect(array('action' => 'schedule', 'division' => $id));
     }
     $pools = array_unique(Set::extract('/Game/pool_id', $games));
     if ($division['Division']['schedule_type'] == 'tournament') {
         $seeds = Set::extract('/Team/initial_seed', $division);
         if (count($division['Team']) != count(array_unique($seeds))) {
             $this->Session->setFlash(__('Each team must have a unique initial seed.', true), 'default', array('class' => 'warning'));
             $this->redirect(array('action' => 'seeds', 'division' => $id));
         }
     }
     $league_obj = $this->_getComponent('LeagueType', $division['Division']['schedule_type'], $this);
     $spirit_obj = $this->_getComponent('Spirit', $division['League']['sotg_questions'], $this);
     $league_obj->sort($division['Team'], $division['Division'], $division['League'], $division['Game'], $spirit_obj, false);
     $reset = $this->_arg('reset');
     $operation = $reset ? 'reset' : 'update';
     // Wrap the whole thing in a transaction, for safety.
     $transaction = new DatabaseTransaction($this->Division);
     // Go through all games, updating seed dependencies
     foreach ($division['Game'] as $game) {
         if (!in_array($game['pool_id'], $pools)) {
             continue;
         }
         if (Game::_is_finalized($game)) {
             continue;
         }
         $this->Division->Game->id = $game['id'];
         foreach (array('Home', 'Away') as $type) {
             if (!empty($game["{$type}PoolTeam"])) {
                 $field = low($type) . '_team';
                 $this->Division->Game->HomePoolTeam->id = $game["{$type}PoolTeam"]['id'];
                 if ($reset) {
                     $team_id = null;
                 } else {
                     switch ($game["{$type}PoolTeam"]['dependency_type']) {
                         case 'seed':
                             $seed = $game["{$type}PoolTeam"]['dependency_id'];
                             if ($seed > count($division['Team'])) {
                                 $this->Session->setFlash(__('Not enough teams in the division to fulfill all scheduled seeds', true), 'default', array('class' => 'warning'));
                                 $this->redirect(array('action' => 'schedule', 'division' => $id));
                             }
                             $team_id = $division['Team'][$seed - 1]['id'];
                             break;
                         case 'pool':
                             $stage = $game["{$type}PoolTeam"]['DependencyPool']['stage'];
                             $pool_id = $game["{$type}PoolTeam"]['dependency_pool_id'];
                             $seed = $game["{$type}PoolTeam"]['dependency_id'];
                             $results = $division['Division']['Pools'][$stage][$pool_id]['Results'];
                             usort($results, array($league_obj, 'compareTeamsResults'));
                             $league_obj->detectAndResolveTies($results, 'compareTeamsResults');
                             $team_id = $results[$seed - 1]['id'];
                             break;
                         case 'ordinal':
                             // The stage we're looking at for these results might be the
                             // one before this one, or it might be two stages ago, if
                             // the previous stage was crossover games.
                             $stage = $game["{$type}PoolTeam"]['Pool']['stage'] - 1;
//.........这里部分代码省略.........
开发者ID:roboshed,项目名称:Zuluru,代码行数:101,代码来源:divisions_controller.php

示例4: _is_tie

 function _is_tie($game, $team_id)
 {
     if (Game::_is_finalized($game)) {
         if ($game['Game']['home_score'] == $game['Game']['away_score']) {
             return 1;
         } else {
             return 0;
         }
     } else {
         if (!empty($game['ScoreEntry'])) {
             $entry = reset($game['ScoreEntry']);
             if ($entry['status'] != 'in_progress' && $entry['score_for'] == $entry['score_against']) {
                 return 1;
             } else {
                 return 0;
             }
         } else {
             // Return a 0 and trust that it will be corrected later
             return 0;
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:22,代码来源:sport.php

示例5: submit_score

 function submit_score()
 {
     $id = $this->_arg('slot');
     if (!$id) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('game slot', true)), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $this->GameSlot->contain(array('Game' => array('HomeTeam', 'HomePoolTeam' => 'DependencyPool', 'Division' => 'League'), 'Field' => array('Facility' => 'Region')));
     $gameSlot = $this->GameSlot->read(null, $id);
     if (!$gameSlot) {
         $this->Session->setFlash(sprintf(__('Invalid %s', true), __('game slot', true)), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     if (empty($gameSlot['Game'])) {
         $this->Session->setFlash(__('This game slot has no games associated with it.', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $game = $gameSlot['Game'][0];
     if ($game['Division']['schedule_type'] != 'competition') {
         $this->Session->setFlash(__('You can only enter scores for multiple games in "competition" divisions.', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     if (Game::_is_finalized($game)) {
         $this->Session->setFlash(__('Games in this slot have already been finalized.', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     $end_time = strtotime("{$gameSlot['GameSlot']['game_date']} {$gameSlot['GameSlot']['display_game_end']}") + Configure::read('timezone.adjust') * 60;
     if ($end_time - 60 * 60 > time()) {
         $this->Session->setFlash(__('That game has not yet occurred!', true), 'default', array('class' => 'info'));
         $this->redirect('/');
     }
     // We need this in a couple of places
     if (League::hasSpirit($game['Division']['League'])) {
         $spirit_obj = $this->_getComponent('Spirit', $game['Division']['League']['sotg_questions'], $this);
     }
     $this->Configuration->loadAffiliate($gameSlot['Field']['Facility']['Region']['affiliate_id']);
     Configure::load("sport/{$game['Division']['League']['sport']}");
     $ratings_obj = $this->_getComponent('Ratings', $game['Division']['rating_calculator'], $this);
     $this->set(compact('gameSlot'));
     if (!empty($this->data)) {
         $teams = $games = $incidents = $errors = array();
         $unplayed = in_array($this->data['Game']['status'], Configure::read('unplayed_status'));
         // We could put these as hidden fields in the form, but we'd need to
         // validate them against the values from the URL anyway, so it's
         // easier to just set them directly here.
         // We use the team_id as the array index, here and in the views,
         // because order matters, and this is a good way to ensure that
         // the correct data gets into the correct form.
         foreach ($gameSlot['Game'] as $i => $game) {
             if (!array_key_exists($game['home_team'], $this->data['Game'])) {
                 $errors[$game['home_team']]['home_score'] = 'Scores must be entered for all teams.';
             } else {
                 $details = $this->data['Game'][$game['home_team']];
                 if ($unplayed) {
                     $score = $rating = null;
                 } else {
                     $score = $details['home_score'];
                     $rating = $ratings_obj->calculateRatingsChange($details['home_score']);
                     $teams[$game['home_team']] = array('id' => $game['home_team'], 'rating' => $game['HomeTeam']['rating'] + $rating, 'seed' => 0);
                 }
                 $games[$game['home_team']] = array('id' => $game['id'], 'status' => $this->data['Game']['status'], 'home_score' => $score, 'rating_points' => $rating, 'approved_by' => $this->UserCache->currentId());
                 if ($details['incident']) {
                     $incidents[$game['home_team']] = array('game_id' => $game['id'], 'team_id' => $game['home_team'], 'type' => $details['type'], 'details' => $details['details'], 'game' => $game);
                 }
             }
         }
         if (!empty($errors)) {
             $this->GameSlot->Game->validationErrors = $errors;
         } else {
             $transaction = new DatabaseTransaction($this->GameSlot);
             if ($this->GameSlot->Game->saveAll($games, array('validate' => 'first'))) {
                 if (Configure::read('scoring.incident_reports') && !empty($incidents)) {
                     if (!$this->GameSlot->Game->Incident->saveAll($incidents, array('validate' => 'first'))) {
                         $this->Session->setFlash(sprintf(__('The %s could not be saved. Please correct the errors below and try again.', true), __('incident data', true)), 'default', array('class' => 'warning'));
                         return;
                     }
                 }
                 // TODO: Replace this with a call to GamesController::_adjustScoreAndRatings, which will
                 // need to be moved to a shared location and adjusted to handle competition differences.
                 // For now, all that function does that this doesn't is stats, and we have no idea how
                 // stats might play out in competition divisions, so this will suffice.
                 $this->GameSlot->Game->Division->Team->saveAll($teams);
                 $transaction->commit();
                 foreach ($gameSlot['Game'] as $i => $game) {
                     Cache::delete("division/{$game['Division']['id']}/standings", 'long_term');
                     Cache::delete("division/{$game['Division']['id']}/schedule", 'long_term');
                     Cache::delete('league/' . $this->GameSlot->Game->Division->league($game['Division']['id']) . '/standings', 'long_term');
                     Cache::delete('league/' . $this->GameSlot->Game->Division->league($game['Division']['id']) . '/schedule', 'long_term');
                 }
                 $resultMessage = __('Scores have been saved and game results posted.', true);
                 $resultClass = 'success';
                 // TODO: Check for changes to the incident text to avoid sending a duplicate email,
                 // and we probably want to change the text of the email slightly to let the recipient
                 // know that it's an update instead of a new incident.
                 // TODO: Combine code from here and games controller?
                 $incidentMessage = '';
                 if (Configure::read('scoring.incident_reports')) {
                     $addr = Configure::read('email.incident_report_email');
                     foreach ($incidents as $incident) {
                         $this->set(array('incident' => $incident, 'game' => $incident['game'], 'division' => $incident['game']['Division'], 'slot' => $gameSlot['GameSlot'], 'field' => $gameSlot['Field'], 'home_team' => $incident['game']['HomeTeam']));
//.........这里部分代码省略.........
开发者ID:roboshed,项目名称:Zuluru,代码行数:101,代码来源:game_slots_controller.php

示例6: displayScore

 function displayScore($game, $division, $league, $show_score_for_team = false)
 {
     // Data may come in one of two forms.
     if (array_key_exists('Game', $game)) {
         // Either all the models are at the same level in the array...
         $details = $game['Game'];
     } else {
         // ...or the Game model is at the top and others are below
         $details = $game;
     }
     $view =& ClassRegistry::getObject('view');
     $is_logged_in = $view->viewVars['is_logged_in'];
     $is_admin = $view->viewVars['is_admin'];
     $is_manager = $view->viewVars['is_manager'] && in_array($league['affiliate_id'], $this->UserCache->read('ManagedAffiliateIDs'));
     $is_volunteer = $view->viewVars['is_volunteer'];
     $is_official = $view->viewVars['is_official'];
     $is_coordinator = in_array($details['division_id'], $this->UserCache->read('DivisionIDs'));
     // Calculate the game start and end time stamps
     $start_time = strtotime("{$game['GameSlot']['game_date']} {$game['GameSlot']['game_start']}") + Configure::read('timezone.adjust') * 60;
     $end_time = strtotime("{$game['GameSlot']['game_date']} {$game['GameSlot']['display_game_end']}") + Configure::read('timezone.adjust') * 60;
     // Check if one of the teams involved in the game is a team the current user is a captain of
     $teams = array_intersect(array($details['home_team'], $details['away_team']), $this->UserCache->read('OwnedTeamIDs'));
     $team_id = array_pop($teams);
     $links = array();
     if (Game::_is_finalized($details)) {
         if (in_array($details['status'], Configure::read('unplayed_status'))) {
             __($details['status']);
         } else {
             if ($division['schedule_type'] == 'competition') {
                 echo $details['home_score'];
             } else {
                 // If scores are being shown from a particular team's perspective,
                 // we may need to swap the home and away scores.
                 if ($show_score_for_team == $details['away_team']) {
                     $first_score = $details['away_score'];
                     $second_score = $details['home_score'];
                 } else {
                     $first_score = $details['home_score'];
                     $second_score = $details['away_score'];
                 }
                 echo "{$first_score} - {$second_score}";
             }
             if (strpos($details['status'], 'default') !== false) {
                 echo ' (' . __('default', true) . ')';
             }
             if (League::hasStats($league)) {
                 if ($team_id || $is_admin || $is_coordinator) {
                     $links[] = $this->Html->link(__('Submit Stats', true), array('controller' => 'games', 'action' => 'submit_stats', 'game' => $details['id'], 'team' => $team_id));
                 }
                 if (($this->params['controller'] != 'games' || $this->params['action'] != 'stats') && ($is_logged_in || Configure::read('feature.public'))) {
                     $links[] = $this->ZuluruHtml->iconLink('stats_24.png', array('controller' => 'games', 'action' => 'stats', 'game' => $details['id'], 'team' => $show_score_for_team), array('alt' => __('Game Stats', true), 'title' => __('Game Stats', true)));
                 }
             }
         }
     } else {
         $score_entry = Game::_get_best_score_entry($game);
         if (!empty($score_entry)) {
             if (in_array($score_entry['status'], Configure::read('unplayed_status'))) {
                 __($score_entry['status']);
             } else {
                 if ($division['schedule_type'] == 'competition') {
                     echo $score_entry['score_for'];
                 } else {
                     // If scores are being shown from a particular team's perspective,
                     // we may need to swap the home and away scores.
                     if ($show_score_for_team == $score_entry['team_id'] || $show_score_for_team === false && $score_entry['team_id'] == $details['home_team']) {
                         $first_score = $score_entry['score_for'];
                         $second_score = $score_entry['score_against'];
                     } else {
                         $first_score = $score_entry['score_against'];
                         $second_score = $score_entry['score_for'];
                     }
                     echo "{$first_score} - {$second_score}";
                 }
             }
             if ($team_id) {
                 if ($score_entry['status'] == 'in_progress') {
                     $links[] = $this->Html->link(__('Live Score', true), array('controller' => 'games', 'action' => 'live_score', 'game' => $details['id'], 'team' => $team_id));
                 } else {
                     if ($score_entry['team_id'] == $team_id) {
                         $links[] = $this->Html->link(__('Edit score', true), array('controller' => 'games', 'action' => 'submit_score', 'game' => $details['id'], 'team' => $team_id));
                     } else {
                         $links[] = $this->Html->link(__('Submit', true), array('controller' => 'games', 'action' => 'submit_score', 'game' => $details['id'], 'team' => $team_id));
                     }
                 }
                 // Check if someone is a captain on both teams that played each other
                 $second_team_id = array_pop($teams);
                 if ($second_team_id) {
                     $links[] = $this->Html->link(__('Submit', true), array('controller' => 'games', 'action' => 'submit_score', 'game' => $details['id'], 'team' => $second_team_id));
                 }
             } else {
                 if ($is_volunteer || $is_official) {
                     // Allow specified individuals (referees, umpires, volunteers) to live score without a team id
                     if ($score_entry['status'] == 'in_progress') {
                         $links[] = $this->Html->link(__('Live Score', true), array('controller' => 'games', 'action' => 'live_score', 'game' => $details['id']));
                     } else {
                         $links[] = $this->Html->link(__('Edit score', true), array('controller' => 'games', 'action' => 'edit', 'game' => $details['id']));
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:roboshed,项目名称:Zuluru,代码行数:101,代码来源:zuluru_game.php

示例7: roundRobinResults

 function roundRobinResults($division, $league, $games, $spirit_obj)
 {
     $results = array();
     foreach ($games as $game) {
         // Season games use the round indicator for which of possible multiple passes
         // through the entire round robin we are in. Tournament games use it for which
         // game in the single round robin we are in, which is needed when scheduling
         // but not when analysing results.
         if ($game['type'] == SEASON_GAME) {
             $round = $game['round'];
         } else {
             $round = 1;
         }
         if (!in_array($game['status'], Configure::read('unplayed_status'))) {
             if (Game::_is_finalized($game)) {
                 $this->addGameResult($division, $league, $results, $game['home_team'], $game['away_team'], $round, $game['home_score'], $game['away_score'], $game['home_carbon_flip'], Game::_get_spirit_entry($game, $game['home_team'], $spirit_obj), $spirit_obj, $game['status'] == 'home_default', $game['status'] == 'normal');
                 $this->addGameResult($division, $league, $results, $game['away_team'], $game['home_team'], $round, $game['away_score'], $game['home_score'], 2 - $game['home_carbon_flip'], Game::_get_spirit_entry($game, $game['away_team'], $spirit_obj), $spirit_obj, $game['status'] == 'away_default', $game['status'] == 'normal');
             } else {
                 $this->addUnplayedGame($division, $results, $game['home_team'], $game['away_team'], $round);
                 $this->addUnplayedGame($division, $results, $game['away_team'], $game['home_team'], $round);
             }
         }
     }
     return $results;
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:25,代码来源:league_type.php


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