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


PHP Team::get方法代码示例

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


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

示例1: getGamesPlayed

 public function getGamesPlayed()
 {
     $teams = Team::get();
     $count = 0;
     foreach ($teams as $team) {
         if ($team->PlayerOne == $this->ID || $team->PlayerTwo == $this->ID) {
             $count++;
         }
     }
     return $count;
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:11,代码来源:Player.php

示例2: assignTeamsForm

 public function assignTeamsForm($game_id)
 {
     $teams = Team::get();
     $teamOne = DropdownField::create('TeamOne', 'Team One', $teams->map('ID', 'getTeamNames'));
     $teamTwo = DropdownField::create('TeamTwo', 'Team Two', $teams->map('ID', 'getTeamNames'));
     $gameID = HiddenField::create('GameID', 'Game ID', $game_id);
     $fields = new FieldList($teamOne, $teamTwo, $gameID);
     $actions = new FieldList(FormAction::create("doAssignTeams")->setTitle("Assign Teams to this game"));
     $required = new RequiredFields('TeamOne', 'TeamTwo');
     $form = Form::create($this, 'doAssignTeams', $fields, $actions, $required);
     $form->setTemplate('forms/AssignTeamsForm');
     return $form;
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:13,代码来源:GamesPage.php

示例3: get_teams

 public function get_teams($team_id, $joint_id = 0)
 {
     // if it's a joint, let's deal it as a joing
     if ($joint_id > 0) {
         // get all the joint entries so we have all the teams
         $joint = new Joint();
         $joint->where("joint_id", $joint_id)->get();
         // not an existing joint?
         if ($joint->result_count() < 1) {
             log_message('error', 'get_teams: joint -> joint not found');
             return false;
         }
         // result array
         $teamarray = array();
         foreach ($joint->all as $key => $join) {
             if (!($team = $this->get_cached($join->team_id))) {
                 $team = new Team();
                 $team->where('id', $join->team_id);
                 $team->get();
             }
             $teamarray[] = $team->get_clone();
         }
         if (empty($teamarray)) {
             log_message('error', 'get_teams: joint -> no teams found');
             return false;
         }
         return $teamarray;
     }
     // if we're here, it means it's a simple team
     if (!($team = $this->get_cached($team_id))) {
         $team = new Team($team_id);
     }
     return array($team);
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:34,代码来源:team.php

示例4: enterMatch

 /**
  * Enter a new match to the database
  * @param  int             $a          Team A's ID
  * @param  int             $b          Team B's ID
  * @param  int             $a_points   Team A's match points
  * @param  int             $b_points   Team B's match points
  * @param  int             $duration   The match duration in minutes
  * @param  int|null        $entered_by The ID of the player reporting the match
  * @param  string|DateTime $timestamp  When the match was played
  * @param  int[]           $a_players  The IDs of the first team's players
  * @param  int[]           $b_players  The IDs of the second team's players
  * @param  string|null     $server     The address of the server where the match was played
  * @param  int|null        $port       The port of the server where the match was played
  * @param  string          $replayFile The name of the replay file of the match
  * @param  string          $mapPlayed  The name of the map where the map was played, only for rotational leagues
  * @return Match           An object representing the match that was just entered
  */
 public static function enterMatch($a, $b, $a_points, $b_points, $duration, $entered_by, $timestamp = "now", $a_players = array(), $b_players = array(), $server = null, $port = null, $replayFile = null, $mapPlayed = null)
 {
     $team_a = Team::get($a);
     $team_b = Team::get($b);
     $a_elo = $team_a->getElo();
     $b_elo = $team_b->getElo();
     $diff = self::calculateEloDiff($a_elo, $b_elo, $a_points, $b_points, $duration);
     // Update team ELOs
     $team_a->changeElo($diff);
     $team_b->changeElo(-$diff);
     $match = self::create(array('team_a' => $a, 'team_b' => $b, 'team_a_points' => $a_points, 'team_b_points' => $b_points, 'team_a_players' => implode(',', $a_players), 'team_b_players' => implode(',', $b_players), 'team_a_elo_new' => $team_a->getElo(), 'team_b_elo_new' => $team_b->getElo(), 'elo_diff' => $diff, 'timestamp' => TimeDate::from($timestamp)->toMysql(), 'duration' => $duration, 'entered_by' => $entered_by, 'server' => $server, 'port' => $port, 'replay_file' => $replayFile, 'map_played' => $mapPlayed, 'status' => 'entered'), 'iiiissiiisiisisss', 'updated');
     $match->updateMatchCount();
     return $match;
 }
开发者ID:bchhun,项目名称:bzion,代码行数:31,代码来源:Match.php

示例5: getTeam

 /**
  * Get the team a player was invited to
  *
  * @return Team
  */
 public function getTeam()
 {
     return Team::get($this->team);
 }
开发者ID:bchhun,项目名称:bzion,代码行数:9,代码来源:Invitation.php

示例6: enterMatch

 /**
  * Enter a new match to the database
  * @param  int             $a          Team A's ID
  * @param  int             $b          Team B's ID
  * @param  int             $a_points   Team A's match points
  * @param  int             $b_points   Team B's match points
  * @param  int             $duration   The match duration in minutes
  * @param  int|null        $entered_by The ID of the player reporting the match
  * @param  string|DateTime $timestamp  When the match was played
  * @param  int[]           $a_players  The IDs of the first team's players
  * @param  int[]           $b_players  The IDs of the second team's players
  * @param  string|null     $server     The address of the server where the match was played
  * @param  int|null        $port       The port of the server where the match was played
  * @param  string          $replayFile The name of the replay file of the match
  * @param  int             $map        The ID of the map where the match was played, only for rotational leagues
  * @param  string          $matchType  The type of match (e.g. official, fm, special)
  * @param  string          $a_color    Team A's color
  * @param  string          $b_color    Team b's color
  * @return Match           An object representing the match that was just entered
  */
 public static function enterMatch($a, $b, $a_points, $b_points, $duration, $entered_by, $timestamp = "now", $a_players = array(), $b_players = array(), $server = null, $replayFile = null, $map = null, $matchType = "official", $a_color = null, $b_color = null)
 {
     $matchData = array('team_a_color' => strtolower($a_color), 'team_b_color' => strtolower($b_color), 'team_a_points' => $a_points, 'team_b_points' => $b_points, 'team_a_players' => implode(',', $a_players), 'team_b_players' => implode(',', $b_players), 'timestamp' => TimeDate::from($timestamp)->toMysql(), 'duration' => $duration, 'entered_by' => $entered_by, 'server' => $server, 'replay_file' => $replayFile, 'map' => $map, 'status' => 'entered', 'match_type' => $matchType);
     if ($matchType === self::OFFICIAL) {
         $team_a = Team::get($a);
         $team_b = Team::get($b);
         $a_elo = $team_a->getElo();
         $b_elo = $team_b->getElo();
         $diff = self::calculateEloDiff($a_elo, $b_elo, $a_points, $b_points, $duration);
         // Update team ELOs
         $team_a->changeElo($diff);
         $team_b->changeElo(-$diff);
         $matchData = array_merge($matchData, array('team_a' => $a, 'team_b' => $b, 'team_a_elo_new' => $team_a->getElo(), 'team_b_elo_new' => $team_b->getElo(), 'elo_diff' => $diff));
     }
     $match = self::create($matchData, 'updated');
     if ($matchType === self::OFFICIAL) {
         $match->updateMatchCount();
     }
     $players = $match->getPlayers();
     Database::getInstance()->startTransaction();
     foreach ($players as $player) {
         $player->setLastMatch($match->getId());
     }
     Database::getInstance()->finishTransaction();
     return $match;
 }
开发者ID:allejo,项目名称:bzion,代码行数:46,代码来源:Match.php

示例7: foreach

            if ($season->getWeekDate($week) == $date) {
                $matches = Match::find('seasonid = ? and week = ?', [$season->seasonid, $week]);
                foreach ($matches as $match) {
                    foreach ([$match->team1id, $match->team2id] as $teamid) {
                        if ($match->result == 0) {
                            // Falta resultado
                            $team = Team::get($teamid);
                            $msg = "Hola {$team->username}, falta por poner el resultado de tu combate de hoy.";
                            echo "-> {$msg}\n";
                            TwitterAuth::botSendPrivateMessage($team->username, $msg);
                            sleep(1);
                        }
                        $video = Video::findOne('matchid = ? and teamid = ? and type = ?', [$match->matchid, $teamid, 1]);
                        if (!$video) {
                            // Falta video
                            $team = Team::get($teamid);
                            $msg = "Hola {$team->username}, falta por poner el vídeo de tu combate de hoy.";
                            echo "-> {$msg}\n";
                            TwitterAuth::botSendPrivateMessage($team->username, $msg);
                            sleep(1);
                        }
                    }
                }
            }
        }
    }
}
if (date('H') * 1 == 17 && date('i') * 1 < 15) {
    // 17:00 - 17:15
    // Videos
    foreach (Season::find('1=1') as $season) {
开发者ID:xJakub,项目名称:LCE,代码行数:31,代码来源:bot.php

示例8: show

    /**
     * @return void
     */
    public function show()
    {

        $resultNames = [
            ['Sin resultado', 'Sin resultado'],
        ];
        for ($i=6; $i>=0; $i--) {
            $resultNames[] = ["Victoria $i-0", "Derrota 0-$i"];
        }
        for ($i=0; $i<=6; $i++) {
            $resultNames[] = ["Derrota 0-$i", "Victoria $i-0"];
        }
        $resultNames[] = ["Victoria 6-0 (sin jugar)", "Derrota 0-6 (sin jugar)"];
        $resultNames[] = ["Derrota 0-6 (sin jugar)", "Victoria 6-0 (sin jugar)"];
        $resultNames[] = ["Aplazado", "Aplazado"];

        if (!($csrf = $_SESSION['csrf'])) {
            $_SESSION['csrf'] = $csrf = rand(1, 1000000) . "";
        }
        $postCsrf = HTMLResponse::fromPOST('csrf', '');

        if ($postCsrf == $csrf) {
            if (HTMLResponse::fromPOST('color') !== null) {
                $this->team->color = HTMLResponse::fromPOST('color');
                $this->team->save();
            }
        }
        $color = $this->team->color;

        ?>
        <div class="inblock" style="margin-right: 16px">
            <a target="_blank" href="/<?=$this->team->getImageLink()?>">
                <img src="/<?=$this->team->getImageLink(300, 200)?>" alt="Logo" class="teamlogo"><br>
            </a>
            <a href="https://twitter.com/hashtag/<?=$this->team->getHashtag()?>" target="_blank">#<?=$this->team->getHashtag()?></a>
            <div style="height:2px"></div>
            <a href="https://twitter.com/<?=$this->team->username?>" target="_blank">@<?=$this->team->username?></a>
            <div style="height: 6px"></div>

            <span style="text-decoration: underline;">Color oficial</span>: <?
            if (preg_match("'^#[abcdefABCDEF0-9]{6}$'", $color)) {
                ?><span id="teamcolor"><?= $color ?></span><?
            } else {
                ?><i id="teamcolor">Sin color</i><?
                $color = '#000000';
            }
            ?>
            <div class="teamcolor" style="background: <?=$color?>"></div>

            <br><?
            if ($this->team->isManager()) {
                ?>
                <br>Eres el Manager del equipo.

                <form action="<?=HTMLResponse::getRoute()?>" method="post" id="colorform">
                    <input type="hidden" name="color" value="<?=$color?>">
                    <input type="hidden" name="csrf" value="<?=$csrf?>">
                </form>
                <?
                $this->design->addJavaScript('/js/jquery-ui.min.js');
                $this->design->addStyleSheet('/css/jquery-ui.min.css');
                $this->design->addStyleSheet('/css/jquery.colorpicker.css');
                $this->design->addJavaScript('/js/jquery.colorpicker.js');
                $this->design->addJavaScript("
                    $('.teamcolor').colorpicker({
                    inline: false,
                    color: '{$color}',
                    colorFormat: '#HEX',
                    closeOnOutside: false,
                    closeOnEscape: false,
                    ok: function(event, color) {
                        $('#colorform input[name=\"color\"]').val(color.formatted);
                        $('#colorform').submit();
                    }
                    }).css('cursor', 'pointer');
                    ", false);
            }
            ?>
        </div>
        <div class="inblock">
            <?

            ?>
            <h2>Calendario de enfrentamientos</h2>
            <table>
                <thead>
                <tr>
                    <td>Jornada</td>
                    <td>Fecha</td>
                    <td>Oponentes</td>
                    <td>Resultado</td>
                    <td>Vídeos</td>
                </tr>
                </thead>
                <tbody>
                <? foreach(Match::find('(team1id = ? or team2id = ?) and seasonid = ? order by week asc',
                    [$this->team->teamid, $this->team->teamid, $this->season->seasonid]) as $match) {
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:Team_Index.php

示例9: setTimeout

                } else {
                    ?>
					<script>
						var timePopup = setTimeout(function(){
							window.parent.boss.removeClass('modal_dialog', 'active');
						}, 100);
						window.parent.boss.popup("Esse(s) membro(s) já estão participando desta equipe.");
					</script>
					<?php 
                    die;
                }
                if ($team_member_set) {
                    $model = new Team();
                    $sql = array('id_team' => $pk, 'id_admin' => $logado['id_member'], 'status' => 1);
                    $model->fields = array('id_project');
                    $rs = $model->get($sql);
                    $rs = $rs[0];
                    ?>
					<script>
						var timePopup = setTimeout(function(){
							window.parent.boss.removeClass('modal_dialog', 'active');
						}, 100);
						window.parent.boss.ajax.load('/app/team/view_team/?pk=<?php 
                    echo $rs["id_project"];
                    ?>
', '#app_pane_body');
						window.parent.boss.popup("Membro(s) adicionados com sucesso.");
					</script>
					<?php 
                }
            }
开发者ID:RenanPalmeira,项目名称:agil-framework,代码行数:31,代码来源:create_team_member.php

示例10: getFromName

 /**
  * Get a single team by its name
  *
  * @param  string $name The team name to look for
  * @return Team
  */
 public static function getFromName($name)
 {
     return Team::get(self::fetchIdFrom($name, 'name', 's'));
 }
开发者ID:bchhun,项目名称:bzion,代码行数:10,代码来源:Team.php

示例11: Team

 /**
  * Returns leader team objects, false in case user is not a team leader
  * 
  * @author Woxxy
  * @param int $team_id if NULL returns each team in which this user is leader
  * @return object Teams
  * 
  */
 function is_team_leader($team_id = NULL, $joint_id = NULL)
 {
     // not logged in? get booted
     if (!$this->is_logged_in()) {
         return FALSE;
     }
     // this calls another function in order to cycle each team in the joint with is_team
     if (!is_null($joint_id) && $joint_id != 0) {
         $teams = new Team();
         return $this->is_team_leader_array($teams->get_teams(0, $joint_id));
     }
     // let's get all the memberships
     if (!isset($this->cached['leaderships'])) {
         $memberships = new Membership();
         $memberships->where('user_id', $this->get_user_id())->where('accepted', 1)->where('is_leader', 1)->get();
         $this->cached['leaderships'] = $memberships->get_clone();
     } else {
         $memberships = $this->cached['leaderships'];
     }
     // if not member of any team, return FALSE
     if ($memberships->result_count() < 1) {
         return FALSE;
     }
     // if a team is set, let's grab the team and return the data of the team
     if (is_numeric($team_id)) {
         foreach ($memberships->all as $membership) {
             if ($membership->team_id == $team_id) {
                 return new Team($team_id);
             }
         }
         return FALSE;
     }
     $teams = new Team();
     // Notice that if you remove the result count on $leaderships, this will not run and the user will be leader of any team!
     foreach ($memberships->all as $key => $membership) {
         $teams->or_where('id', $membership->team_id);
     }
     $teams->get();
     return $teams;
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:48,代码来源:Tank_auth.php

示例12: unserialize

 /**
  * {@inheritdoc}
  */
 public function unserialize($data)
 {
     $data = unserialize($data);
     $this->__construct(\Team::get($data['team']), \Player::get($data['deleter']));
 }
开发者ID:blast007,项目名称:bzion,代码行数:8,代码来源:TeamDeleteEvent.php

示例13: get_teams

	public function get_teams($team_id, $joint_id = 0) {
		if ($joint_id > 0) {
			$joint = new Joint();
			$joint->where("joint_id", $joint_id)->get();
			if ($joint->result_count() < 1) {
				log_message('error', 'get_teams: joint -> joint not found');
				return false;
			}

			$teamarray = array();
			$team = new Team();
			foreach ($joint->all as $key => $join) {
				$team->where('id', $join->team_id);
				$team->get();
				$teamarray[] = $team->get_clone();
			}

			if ($team->result_count() < 1) {
				log_message('error', 'get_teams: joint -> no teams found');
				return false;
			}

			return $teamarray;
		}

		$team = new Team($team_id);
		return array($team);
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:28,代码来源:team.php

示例14: testMiscMethods

 public function testMiscMethods()
 {
     $this->team = Team::createTeam("Sample Team", $this->player->getId(), "Avatar", "Description");
     $team = Team::get($this->team->getId());
     $this->assertEquals("now", $team->getCreationDate());
 }
开发者ID:bchhun,项目名称:bzion,代码行数:6,代码来源:TeamTest.php

示例15: Membership

	/**
	 * Returns leader team objects, false in case user is not a team leader
	 * 
	 * @author Woxxy
	 * @param int $team_id if NULL returns each team in which this user is leader
	 * @return object Teams
	 * 
	 */
	function is_team_leader($team_id = NULL) {
		if (!$this->is_logged_in())
			return FALSE;

		$leaderships = new Membership();
		$leaderships->where('user_id', $this->get_user_id())->where('accepted', 1)->where('is_leader', 1);

		if (is_numeric($team_id)) {
			$leaderships->where('team_id', $team_id);
			$leaderships->get();
			if ($leaderships->result_count() != 1)
				return FALSE;
			$team = new Team();
			$team->where('id', $team_id)->get();
			return $team;
		}

		$leaderships->get();
		if ($leaderships->result_count() < 1)
			return FALSE;
		$teams = new Team();
		// Notice that if you remove the result count on $leaderships, this will not run and the user will be leader of any team!
		foreach ($leaderships->all as $key => $leadership) {
			$teams->or_where('id', $leadership->team_id);
		}
		$teams->get();
		return $teams;
	}
开发者ID:Nakei,项目名称:FoOlSlide,代码行数:36,代码来源:Tank_auth.php


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