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


PHP Team::get_roster_positions方法代码示例

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


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

示例1: process

 function process()
 {
     global $lr_session;
     $this->title = $this->team->name;
     $this->template_name = 'pages/team/view.tpl';
     $this->smarty->assign('team', $this->team);
     if ($this->team->home_field) {
         $field = Field::load(array('fid' => $this->team->home_field));
         $this->smarty->assign('home_field', $field);
     }
     $teamSBF = $this->team->calculate_sbf();
     if ($teamSBF) {
         $this->smarty->assign('team_sbf', $teamSBF);
         $league = League::load(array('league_id' => $this->team->league_id));
         $this->smarty->assign('league_sbf', $league->calculate_sbf());
     }
     if ($lr_session->has_permission('team', 'player shirts', $this->team->team_id)) {
         $this->smarty->assign('display_shirts', true);
     }
     $rosterPositions = Team::get_roster_positions();
     $this->smarty->assign('roster_positions', $rosterPositions);
     $this->team->get_roster();
     $this->team->check_roster_conflict();
     foreach ($this->team->roster as $player) {
         $player->status = $rosterPositions[$player->status];
     }
     $min_roster = $league->min_roster_size;
     if ($this->team->roster_count < $min_roster && ($lr_session->is_captain_of($this->team->team_id) || $lr_session->is_admin()) && $this->team->roster_deadline > 0) {
         $this->smarty->assign('roster_requirement', $min_roster);
         $this->smarty->assign('display_roster_note', true);
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:33,代码来源:view.php

示例2: process

 function process()
 {
     global $lr_session;
     // Using these multiple times, so saving them
     $is_admin = $lr_session->is_admin();
     $is_captain = $lr_session->is_captain_of($this->team->team_id);
     $this->title = "{$this->team->name} &raquo; Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         info_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} &raquo; Add Player";
         if (!($is_admin || $is_captain)) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $events = $this->player->is_eligible_for($this->team->team_id);
     if ($events !== true) {
         // Captains and admins can modify players even if they haven't registered for events.
         // That way, the onus is on the player to register, saving captains the hassle.
         // So, only disable the roster change for players
         if (!($is_admin || $is_captain)) {
             $this->smarty->assign('prerequisites', $events);
             $this->smarty->assign('disabled', 'disabled="disabled"');
         }
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:59,代码来源:roster.php

示例3: process

 function process()
 {
     global $lr_session;
     $this->title = "{$this->team->name} &raquo; Roster Status";
     if ($this->team->roster_deadline > 0 && !$lr_session->is_admin() && time() > $this->team->roster_deadline) {
         error_exit('The roster deadline has passed.');
     }
     if (!$this->player) {
         $this->title = "{$this->team->name} &raquo; Add Player";
         if (!($lr_session->is_admin() || $lr_session->is_captain_of($this->team->team_id))) {
             error_exit("You cannot add a person to that team!");
         }
         $new_handler = new person_search();
         $new_handler->smarty =& $this->smarty;
         $new_handler->initialize();
         $new_handler->ops['Add to ' . $this->team->name] = 'team/roster/' . $this->team->team_id;
         $new_handler->process();
         $this->template_name = $new_handler->template_name;
         return true;
     }
     if (!$this->player->is_player()) {
         error_exit('Only registered players can be added to a team.');
     }
     $this->positions = Team::get_roster_positions();
     $this->currentStatus = $this->team->get_roster_status($this->player->user_id);
     $this->permittedStates = $this->permitted_roster_states();
     $edit =& $_POST['edit'];
     if ($this->player->status != 'active' && $edit['status'] && $edit['status'] != 'none') {
         error_exit("Inactive players may only be removed from a team.  Please contact this player directly to have them activate their account.");
     }
     if ($edit['step'] != 'perform') {
         $this->smarty->assign('current_status', $this->positions[$this->currentStatus]);
         $this->smarty->assign('player', $this->player);
         $this->smarty->assign('team', $this->team);
         $this->smarty->assign('states', $this->permittedStates);
         return true;
     }
     if (!array_key_exists($edit['status'], $this->permittedStates)) {
         error_exit("You do not have permission to set that status.");
     }
     if (!$this->team->set_roster_status($this->player->user_id, $edit['status'], $this->currentStatus)) {
         error_exit("Could not set roster status for {$this->player->fullname}");
     }
     local_redirect(url("team/view/" . $this->team->team_id));
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:46,代码来源:roster.php

示例4: getStatesForAdministrator

 function getStatesForAdministrator($current_status)
 {
     return array_keys(Team::get_roster_positions());
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:4,代码来源:team.php

示例5: process

 function process()
 {
     global $lr_session, $dbh;
     $this->title = $lr_session->attr_get('fullname');
     $this->template_name = 'pages/home.tpl';
     /* Handle display of RSS feed itmes, if enabled */
     $feed_url = variable_get('rss_feed_url', null);
     if ($feed_url) {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $feed_url);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
         # Fetch RSS data
         $xml = curl_exec($curl);
         curl_close($curl);
         if ($xml) {
             $xmlObj = simplexml_load_string($xml);
             $count = 0;
             $limit = variable_get('rss_feed_items', 2);
             $items = array();
             foreach ($xmlObj->channel[0]->item as $item) {
                 $items[] = array('title' => $item->title, 'link' => $item->link);
                 if (++$count >= $limit) {
                     break;
                 }
             }
             if ($count > 0) {
                 $this->smarty->assign('rss_feed_title', variable_get('rss_feed_title', 'OCUA Volunteer Opportunities'));
                 $this->smarty->assign('rss_feed_items', $items);
             }
         }
     }
     /* Display teams */
     $rosterPositions = Team::get_roster_positions();
     $teams = array();
     foreach ($lr_session->user->teams as $team) {
         $team->rendered_position = $rosterPositions[$team->position];
         $teams[] = $team;
     }
     reset($lr_session->user->teams);
     $this->smarty->assign('teams', $teams);
     /* Display leagues */
     // TODO: For each league, need to display # of missing scores,
     // pending scores, etc.
     $this->smarty->assign('leagues', $lr_session->user->leagues);
     /* Display recent and upcoming games */
     $games = array();
     // TODO: query should be moved to person object, or a helper in game.inc
     $sth = $dbh->prepare('SELECT s.game_id, t.team_id, t.status FROM schedule s, gameslot g, teamroster t WHERE s.published AND ((s.home_team = t.team_id OR s.away_team = t.team_id) AND t.player_id = ?) AND g.game_id = s.game_id AND g.game_date < CURDATE() ORDER BY g.game_date desc, g.game_start desc LIMIT 4');
     $sth->execute(array($lr_session->user->user_id));
     while ($row = $sth->fetch(PDO::FETCH_OBJ)) {
         $game = Game::load(array('game_id' => $row->game_id));
         $game->user_team_id = $row->team_id;
         $games[] = $game;
     }
     $games = array_reverse($games);
     $sth = $dbh->prepare('SELECT s.game_id, t.team_id, t.status FROM schedule s, gameslot g, teamroster t WHERE s.published AND ((s.home_team = t.team_id OR s.away_team = t.team_id) AND t.player_id = ?) AND g.game_id = s.game_id AND g.game_date >= CURDATE() ORDER BY g.game_date asc, g.game_start asc LIMIT 4');
     $sth->execute(array($lr_session->user->user_id));
     while ($row = $sth->fetch(PDO::FETCH_OBJ)) {
         $game = Game::load(array('game_id' => $row->game_id));
         $game->user_team_id = $row->team_id;
         $games[] = $game;
     }
     foreach ($games as $game) {
         $score = '';
         if ($game->is_finalized()) {
             $score = "{$game->home_score} - {$game->away_score}";
         } else {
             /* Not finalized yet, so we will either:
              *   - display entered score if present
              *   - display score entry link if game date has passed
              *   - display a blank otherwise
              */
             $entered = $game->get_score_entry($game->user_team_id);
             if ($entered) {
                 // need to match entered score order to displayed team order!
                 if ($entered->team_id == $game->home_id) {
                     $score = "{$entered->score_for} - {$entered->score_against}";
                 } else {
                     $score = "{$entered->score_against} - {$entered->score_for}";
                 }
                 $score .= " (unofficial, waiting for opponent)";
                 $game->score_entered = $score;
             } else {
                 if ($lr_session->has_permission('game', 'submit score', $game) && $game->timestamp < time()) {
                     $game->user_can_submit = true;
                 }
             }
         }
     }
     $this->smarty->assign('games', $games);
     return;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:93,代码来源:home.php


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