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


PHP Team::load方法代码示例

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


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

示例1: process

 function process()
 {
     global $CONFIG;
     $this->template_name = 'pages/team/ical.tpl';
     $this->smarty->assign('team', $this->team);
     $this->smarty->assign('short_league_name', variable_get('app_org_short_name', 'League'));
     # Our timezone is specified as US/Eastern, but ical wants US-Eastern.  bleh.
     $timezone = preg_replace("!/!", "-", $CONFIG['localization']['local_tz']);
     $this->smarty->assign('timezone', $timezone);
     /*
      * Grab schedule info
      */
     $games = Game::load_many(array('either_team' => $this->team->team_id, 'published' => 1, '_order' => 'g.game_date DESC,g.game_start,g.game_id'));
     // We'll be outputting an ical
     header('Content-type: text/calendar; charset=UTF-8');
     // Prevent caching
     header("Cache-Control: no-cache, must-revalidate");
     // get domain URL for signing games
     $arr = explode('@', variable_get('app_admin_email', "@{$short_league_name}"));
     $this->smarty->assign('domain_url', $arr[1]);
     // date stamp this file
     // MUST be in UTC
     $this->smarty->assign('now', gmstrftime('%Y%m%dT%H%M%SZ'));
     while (list(, $game) = each($games)) {
         $opponent_id = $game->home_id == $this->team->team_id ? $game->away_id : $game->home_id;
         $game->opponent = Team::load(array('team_id' => $opponent_id));
         $game->field = Field::load(array('fid' => $game->fid));
     }
     $this->smarty->assign('games', $games);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:30,代码来源:ical.php

示例2: __construct

 function __construct($id)
 {
     $this->team = Team::load(array('team_id' => $id));
     if (!$this->team) {
         error_exit("That team does not exist");
     }
     team_add_to_menu($this->team);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:8,代码来源:TeamHandler.php

示例3: process

 function process()
 {
     global $lr_session;
     # Nuke HTML just in case
     $team_name = check_form($this->team->name, ENT_NOQUOTES);
     $this->title = "{$team_name} » Move";
     $edit = $_POST['edit'];
     if ($edit['step']) {
         if ($edit['target'] < 1) {
             error_exit("That is not a valid league to move to");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $edit['target'])) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
         $targetleague = League::load(array('league_id' => $edit['target']));
         if (!$targetleague) {
             error_exit("You must supply a valid league to move to");
         }
         if ($targetleague->league_id == $this->team->league_id) {
             error_exit("You can't move a team to the league it's currently in!");
         }
     }
     if ($edit['swaptarget']) {
         $target_team = Team::load(array('team_id' => $edit['swaptarget']));
         if (!$target_team) {
             error_exit("You must supply a valid target team ID");
         }
         if ($target_team->league_id == $this->team->league_id) {
             error_exit("You can't swap with a team that's already in the same league!");
         }
         if ($target_team->league_id != $targetleague->league_id) {
             error_exit("You can't swap with a team that's not in the league you want to move to!");
         }
         if (!$lr_session->has_permission('league', 'manage teams', $target_team->league_id)) {
             error_exit("Sorry, you cannot move teams to leagues you do not coordinate");
         }
     }
     switch ($edit['step']) {
         case 'perform':
             $sourceleague = League::load(array('league_id' => $this->team->league_id));
             $this->perform($targetleague, $target_team);
             local_redirect(url("league/view/" . $sourceleague->league_id));
         case 'confirm':
             return $this->confirm($targetleague, $target_team);
         case 'swaptarget':
             return $this->choose_swaptarget($targetleague);
         default:
             return $this->choose_league();
     }
     error_exit("Error: This code should never be reached.");
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:51,代码来源:move.php

示例4: __construct

 function __construct($game_id, $team_id)
 {
     parent::__construct($game_id);
     $this->team = Team::load(array('team_id' => $team_id));
     team_add_to_menu($this->team);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:6,代码来源:submitscore.php

示例5: assoc_obj

 function assoc_obj()
 {
     if (!$this->assoc_obj) {
         if ($this->assoc_type == 'person') {
             $this->assoc_obj = Person::load(array('user_id' => $this->assoc_id));
         } elseif ($this->assoc_type == 'team') {
             $this->assoc_obj = Team::load(array('team_id' => $this->assoc_id));
         } else {
             die("Invalid assoc_type of " . $this->assoc_type);
         }
     }
     return $this->assoc_obj;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:13,代码来源:note.php

示例6: process

 function process()
 {
     global $dbh;
     $this->title = 'Team Statistics';
     $rows = array();
     $current_season = variable_get('current_season', 'Summer');
     $sth = $dbh->prepare('SELECT COUNT(*) FROM team');
     $sth->execute();
     $rows[] = array("Number of teams (total):", $sth->fetchColumn());
     $sth = $dbh->prepare('SELECT l.season, COUNT(*) FROM leagueteams t, league l WHERE t.league_id = l.league_id AND l.status = "open" GROUP BY l.season');
     $sth->execute();
     $sub_table = array();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $sub_table[] = $row;
     }
     $rows[] = array("Teams by season:", table(null, $sub_table));
     $sth = $dbh->prepare("SELECT t.team_id,t.name, COUNT(r.player_id) as size \n\t\tFROM teamroster r, league l, leagueteams lt\n\t\tLEFT JOIN team t ON (t.team_id = r.team_id) \n\t\tWHERE\n\t\t\tlt.team_id = r.team_id\n\t\t\tAND l.league_id = lt.league_id\n\t\t\t\t\tAND l.status = 'open'\n\t\t\tAND l.schedule_type != 'none'\n\t\t\t\t\tAND l.season = ?\n\t\t\tAND (r.status = 'player' OR r.status = 'captain' OR r.status = 'assistant')\n\t\tGROUP BY t.team_id\n\t\tHAVING size < 12\n\t\tORDER BY size desc, t.name");
     $sth->execute(array($current_season));
     $sub_table = array();
     $sub_sth = $dbh->prepare("SELECT COUNT(*) FROM teamroster r WHERE r.team_id = ? AND r.status = 'substitute'");
     while ($row = $sth->fetch()) {
         if ($row['size'] < 12) {
             $sub_sth->execute(array($row['team_id']));
             $substitutes = $sub_sth->fetchColumn();
             if ($row['size'] + floor($substitutes / 3) < 12) {
                 $sub_table[] = array(l($row['name'], "team/view/" . $row['team_id']), $row['size'] + floor($substitutes / 3));
             }
         }
     }
     $rows[] = array("{$current_season} teams with too few players:", table(null, $sub_table));
     $sth = $dbh->prepare("SELECT t.team_id, t.name, t.rating\n\t\t\tFROM team t, league l, leagueteams lt\n\t\t\tWHERE\n\t\t\t\tlt.team_id = t.team_id\n\t\t\t\tAND l.league_id = lt.league_id\n\t\t\t\tAND l.status = 'open'\n\t\t\t\tAND l.schedule_type != 'none'\n\t\t\t\tAND l.season = ?\n\t\t\tORDER BY t.rating DESC LIMIT 10");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $sub_table[] = array(l($row['name'], "team/view/" . $row['team_id']), $row['rating']);
     }
     $rows[] = array("Top-rated {$current_season} teams:", table(null, $sub_table));
     $sth = $dbh->prepare("SELECT t.team_id, t.name, t.rating\n\t\t\tFROM team t, league l, leagueteams lt\n\t\t\tWHERE\n\t\t\t\tlt.team_id = t.team_id\n\t\t\t\tAND l.league_id = lt.league_id\n\t\t\t\tAND l.status = 'open'\n\t\t\t\tAND l.schedule_type != 'none'\n\t\t\t\tAND l.season = ?\n\t\t\tORDER BY t.rating ASC LIMIT 10");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $sub_table[] = array(l($row['name'], "team/view/" . $row['team_id']), $row['rating']);
     }
     $rows[] = array("Lowest-rated {$current_season} teams:", table(null, $sub_table));
     $sth = $dbh->prepare("SELECT COUNT(*) AS num,\n\t\t\t\tIF(s.status = 'home_default',s.home_team,s.away_team) AS team_id\n\t\t\tFROM schedule s, league l\n\t\t\tWHERE\n\t\t\t\ts.league_id = l.league_id\n\t\t\t\tAND l.status = 'open'\n\t\t\t\tAND l.season = ?\n\t\t\t\tAND (s.status = 'home_default' OR s.status = 'away_default')\n\t\t\tGROUP BY team_id ORDER BY num DESC");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $team = Team::load(array('team_id' => $row['team_id']));
         $sub_table[] = array(l($team->name, "team/view/" . $row['team_id']), $row['num']);
     }
     $rows[] = array("Top defaulting {$current_season} teams:", table(null, $sub_table));
     $sth = $dbh->prepare("SELECT COUNT(*) AS num,\n\t\t\t\tIF(s.approved_by = -3,s.home_team,s.away_team) AS team_id\n\t\t\tFROM schedule s, league l\n\t\t\tWHERE\n\t\t\t\ts.league_id = l.league_id\n\t\t\t\tAND l.status = 'open'\n\t\t\t\tAND l.season = ?\n\t\t\t\tAND (s.approved_by = -2 OR s.approved_by = -3)\n\t\t\tGROUP BY team_id ORDER BY num DESC");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $team = Team::load(array('team_id' => $row['team_id']));
         $sub_table[] = array(l($team->name, "team/view/" . $row['team_id']), $row['num']);
     }
     $rows[] = array("Top non-score-submitting {$current_season} teams:", table(null, $sub_table));
     $sotg_query = "SELECT\n\t\t\t\tROUND( AVG( s.score_entry_penalty + s.timeliness + s.rules_knowledge + s.sportsmanship + s.rating_overall ), 2) AS avgspirit,\n\t\t\t\ts.tid AS team_id\n\t\t\tFROM league l, leagueteams lt, spirit_entry s\n\t\t\tWHERE\n\t\t\t\tlt.league_id = l.league_id\n\t\t\t\tAND lt.team_id = s.tid\n\t\t\t\tAND l.status = 'open'\n\t\t\t\tAND l.season = ?\n\t\t\tGROUP BY team_id";
     $sth = $dbh->prepare($sotg_query . " ORDER BY avgspirit DESC LIMIT 10");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $team = Team::load(array('team_id' => $row['team_id']));
         $sub_table[] = array(l($team->name, "team/view/" . $row['team_id']), $row['avgspirit']);
     }
     $rows[] = array("Best spirited {$current_season} teams:", table(null, $sub_table));
     $sth = $dbh->prepare($sotg_query . " ORDER BY avgspirit ASC LIMIT 10");
     $sth->execute(array($current_season));
     $sub_table = array();
     while ($row = $sth->fetch()) {
         $team = Team::load(array('team_id' => $row['team_id']));
         $sub_table[] = array(l($team->name, "team/view/" . $row['team_id']), $row['avgspirit']);
     }
     $rows[] = array("Lowest spirited {$current_season} teams:", table(null, $sub_table));
     $output = "<div class='pairtable'>" . table(null, $rows) . "</div>";
     return form_group("Team Statistics", $output);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:80,代码来源:team.php

示例7: get_home_team_object

 function get_home_team_object()
 {
     if (is_null($this->_home_team_object)) {
         if ($this->home_id) {
             $this->_home_team_object = Team::load(array('team_id' => $this->home_id));
         } else {
             return null;
         }
     }
     return $this->_home_team_object;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:11,代码来源:game.php

示例8: perform

 function perform($edit)
 {
     global $lr_session;
     if (!$this->can_edit) {
         error_exit("You do not have permission to edit this game");
     }
     $s = new Spirit();
     $home_spirit = $s->as_formbuilder();
     $away_spirit = $s->as_formbuilder();
     if ($_POST['spirit_home']) {
         $home_spirit->bulk_set_answers($_POST['spirit_home']);
     }
     if ($_POST['spirit_away']) {
         $away_spirit->bulk_set_answers($_POST['spirit_away']);
     }
     $dataInvalid = $this->isDataInvalid($edit);
     if ($edit['status'] == 'normal') {
         $dataInvalid .= $home_spirit->answers_invalid();
         $dataInvalid .= $away_spirit->answers_invalid();
     }
     if ($dataInvalid) {
         error_exit($dataInvalid . "<br>Please use your back button to return to the form, fix these errors, and try again");
     }
     // store the old info:
     $oldgameresults['home_score'] = $this->game->home_score;
     $oldgameresults['away_score'] = $this->game->away_score;
     // Now, finalize score.
     $this->game->set('home_score', $edit['home_score']);
     $this->game->set('away_score', $edit['away_score']);
     $this->game->set('status', $edit['status']);
     $this->game->set('approved_by', $lr_session->attr_get('user_id'));
     // For a normal game, save spirit entries.
     if ($edit['status'] == 'normal') {
         # TODO: don't need to do this unless there are changes.
         if (!$s->store_spirit_entry($this->game, $this->game->home_id, $lr_session->attr_get('user_id'), $home_spirit->bulk_get_answers())) {
             error_exit("Error saving spirit entry for " . $this->game->home_name);
         }
         if (!$s->store_spirit_entry($this->game, $this->game->away_id, $lr_session->attr_get('user_id'), $away_spirit->bulk_get_answers())) {
             error_exit("Error saving spirit entry for " . $this->game->away_name);
         }
     }
     switch ($edit['status']) {
         // for defaults, have to prepare both home and away spirit scores!
         case 'normal':
         default:
             break;
     }
     // load the teams in order to be able to save their current rating
     $home_team = Team::load(array('team_id' => $this->game->home_id));
     $away_team = Team::load(array('team_id' => $this->game->away_id));
     // only save the current team ratings if we didn't already save them
     if ($this->game->rating_home == null || $this->game->rating_home == "" && $this->game->rating_away == null || $this->game->rating_away == "") {
         // save the current snapshot of each team's rating:
         $this->game->set('rating_home', $home_team->rating);
         $this->game->set('rating_away', $away_team->rating);
     }
     if (!$this->game->save()) {
         error_exit("Could not successfully save game results");
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:61,代码来源:edit.php


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