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


PHP Match::find方法代码示例

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


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

示例1: detailAction

 public function detailAction($id)
 {
     $id = $this->filter->sanitize($id, array("int"));
     if ($id) {
         $searchParams = array("id = '" . $id . "'");
         $debts = Debts::findFirst($searchParams);
         $this->view->setVar("debts", $debts);
         $debt = Debt::find("fid = " . $id);
         $this->view->debt = $debt;
         $this->view->website = FILEWEBNAME;
         $match = Match::find("debt_number  = '" . $debts->number . "'");
         $this->view->match = $match;
         foreach ($match as $key => $val) {
         }
         fb($match->toArray());
     } else {
         $this->flash->error("没有找到对应的债权");
         return $this->forward("debt/index");
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:20,代码来源:PersonalController.php

示例2: doClaim

 private function doClaim($is_duplicate)
 {
     $claim_match_id = Input::get('match-id');
     Log::info("======[claim_match_id]======");
     Log::info($claim_match_id);
     Log::info(Input::all());
     $match = Match::find($claim_match_id);
     $fip = FindPeople::find($match->fip_id);
     // MARK match as claimed and FIP as found
     $match->claimed = true;
     $match->save();
     $fip->found = true;
     $fip->duplicate = $is_duplicate;
     if ($match->match_army_update) {
         $fip->found_in_army_updates = true;
         $au = ArmyUpdates::find($match->match_table_id);
         $au->claimed = true;
         $au->save();
         // not deleting. allowing duplicate claims instead
         //Match::where('match_table_id', '=', $au->id)->delete();
     }
     if ($match->match_found_person) {
         $fip->found_in_found_people = true;
         $fop = FoundPeople::find($match->match_table_id);
         $fop->claimed = true;
         $fop->save();
         //Match::where('match_table_id', '=', $fop->id)->delete();
     }
     $fip->found_table_id = $match->match_table_id;
     $fip->save();
     Match::deleteMatchesForFip($fip->id);
     // TODO : also send back the id in the table it was matched to
     // Turn into Found
     $response = array('status' => 'success', 'fip-id' => $fip->id);
     return Response::json($response);
 }
开发者ID:riddhi1212,项目名称:Laravel-app-1,代码行数:36,代码来源:ClaimController.php

示例3: showTeamSeasons

    private function showTeamSeasons()
    {
        $teamSeasonIds = Model::pluck(SeasonTeam::find('teamid = ?', [$this->team->teamid]), 'seasonid');
        $teamSeasons = Season::getMultiple($teamSeasonIds);
        Model::orderBy($teamSeasons, 'seasonid');

        $teamMatches = Match::find('team1id = ? or team2id = ?', [$this->team->teamid, $this->team->teamid]);
        // $games = [];
        $playedGames = [];
        $wins = [];
        $losses = [];

        foreach($teamMatches as $match) {
            if (!$match->isPublished()) continue;
            // $games[$match->seasonid]++;
            if ($match->getWinner() == $this->team->teamid) {
                $playedGames[$match->seasonid]++;
                $wins[$match->seasonid]++;
            }
            if ($match->getLooser() == $this->team->teamid) {
                $playedGames[$match->seasonid]++;
                $losses[$match->seasonid]++;
            }
        }

        ?>
        <h2>Actividad por temporadas</h2>

        <table style="width: 400px">
        <thead><tr>
            <td>Nombre</td>
            <td>Combates</td>
            <td>Victorias</td>
            <td>Derrotas</td>
        </tr></thead>
        <?
        foreach($teamSeasons as $season) {
            if (!$season->ispublic && !Team::isSuperAdmin()) continue;
            ?>
            <tr>
                <td>
                    <a href="/<?=$season->getLink()?>/equipos/<?=$this->team->getLink()?>/">
                        <?= htmlentities($season->name) ?>
                    </a>
                </td>
                <td><?= $playedGames[$season->seasonid] * 1 ?></td>
                <td><?= $wins[$season->seasonid] * 1 ?></td>
                <td><?= $losses[$season->seasonid] * 1 ?></td>
            </tr>
            <?
        }
        ?></table><br><?

    }
开发者ID:xJakub,项目名称:LCE,代码行数:54,代码来源:Team_Index.php

示例4: show

    /**
     * @return void
     */
    public function show()
    {
        $week = $this->week;
        $canVote = $this->canVote;

        $publishTime = $this->season->getPublishTimeForWeek($week);

        if ($publishTime >= 1000) {

            $days = explode(',', 'Domingo,Lunes,Martes,Miércoles,Jueves,Viernes,Sábado');
            $months = explode(',', 'enero,febrero,marzo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre')

            ?>
            <div>
                <?= $days[date('w', $publishTime)] ?>
                <?= date('j', $publishTime)?> de <?= $months[date('m', $publishTime)-1] ?> de <?= date('Y', $publishTime) ?>,
                <?= date('H:i', $publishTime) ?> (hora española)
            </div>
        <? } ?>
        <div style="height: 6px"></div>
        <table style="border: 0; padding: 0; margin: 0; width: 100%">
            <tr>
                <td style="width: 150px; border: 0; padding: 0; margin: 0; text-align: left">
                    <?
                    if ($this->week > 1) {
                        ?>
                        <a style="float:left; margin-left: 24px" href="/<?=$this->season->getLink()?>/jornadas/<?=$this->week-1?>/">
                            &lt;&lt;
                            Ver <?= strtolower($this->season->getWeekName($this->week-1)) ?>
                        </a>
                        <?
                    }
                    ?>
                </td>
                <td style="border: 0; padding: 0; margin: 0; text-align: center">
                    <?
                    if (time() >= $publishTime) {
                        ?>
                        <a href="javascript:void(0)" onclick="$('._grayscale').toggleClass('grayscale'); $('.result').toggle(); $(this).find('span').toggle()">
                            <span>Mostrar resultados</span>
                            <span style="display: none">Ocultar resultados</span>
                        </a>
                        <?
                    }
                    ?>
                </td>
                <td style="width: 150px; border: 0; padding: 0; margin: 0; text-align: right"><?
                    if ($this->week < $this->maxWeek) {
                        ?>
                        <a style="float:right; margin-right: 24px" href="/<?=$this->season->getLink()?>/jornadas/<?=$this->week+1?>/">
                            Ver <?= strtolower($this->season->getWeekName($this->week+1)) ?>
                            &gt;&gt;
                        </a>
                        <?
                    }
                    ?>
                </td>
            </tr>
        </table>
        <?

        $matches = Match::find('seasonid = ? and week = ? order by matchid asc', [$this->season->seasonid, $week]);
        #shuffle($matches);

        if (!$matches) {
            ?>
            No hay enfrentamientos disponibles en estos momentos.<br><br>
            <?
            return;
        }

        foreach($matches as $match) {
            $team1 = $match->getTeam1();
            $team2 = $match->getTeam2();

            if (false && rand(0,1) == 1) {
                $tmp = $team2;
                $team2 = $team1;
                $team1 = $tmp;
            }


            $voteTeamid = HTMLResponse::fromPOST('teamid','') * 1;
            $voteMatchid = HTMLResponse::fromPOST('matchid','') * 1;
            $voteUnteamid = HTMLResponse::fromPOST('unteamid','') * 1;
            $voteUnmatchid = HTMLResponse::fromPOST('unmatchid','') * 1;

            if ($canVote && TwitterAuth::isLogged() && !$match->hasVoted() && $match->matchid &&
                $voteMatchid == $match->matchid && ($voteTeamid == $team1->teamid || $voteTeamid == $team2->teamid)) {
                $bet = Bet::create();
                $bet->matchid = $match->matchid;
                $bet->dateline = time();
                $bet->userid = TwitterAuth::getUserId();
                $bet->teamid = $voteTeamid;
                $bet->username = TwitterAuth::getUserName();
                $bet->avatar = $_SESSION['twitter-avatar'];
                $bet->save();
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:Season_Index.php

示例5: restoreResults

 public function restoreResults() {
     $matches = Match::find('1=1');
     foreach($matches as $match) {
         if (isset($this->results[$match->matchid])) {
             $match->result = $this->results[$match->matchid];
         }
     }
     Match::saveAll($matches);
 }
开发者ID:xJakub,项目名称:LCE,代码行数:9,代码来源:Batch.php

示例6: show

    /**
     * @return void
     */
    public function show()
    {
        if (!Team::isSuperAdmin()) {
            HTMLResponse::exitWithRoute('/');
        }

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

        $totalWeeks = $this->season->getWeeksCount();
        if ($csrf == $postCsrf) {
            $this->season->mainweeks = HTMLResponse::fromPOST('mainweeks', $this->season->mainweeks);
            $this->season->playoffsweeks = HTMLResponse::fromPOST('playoffsweeks', $this->season->playoffsweeks);
            $this->season->save();
        }

        ?>
        <div class="inblock middle">
        <form action="<?=HTMLResponse::getRoute()?>" method="post">
            <table style="width:640px; margin: 0 auto; text-align: left">
                <thead>
                <tr style="text-align: center">
                    <td>
                        Propiedad
                    </td>
                    <td>
                        Valor
                    </td>
                </tr>
                </thead>
                <tr>
                    <td>
                        <b>Número de jornadas (principales)</b>
                    </td><td>
                        <input name="mainweeks" type="number" value="<?=htmlentities($this->season->mainweeks)?>">
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Número de jornadas (playoffs)</b>
                    </td><td>
                        <input name="playoffsweeks" type="number" value="<?=htmlentities($this->season->playoffsweeks)?>">
                    </td>
                </tr>
            </table>

            <?
            $teams = $this->season->getTeams(false);
            $maxMatches = ceil(count($teams)/2);

            $matches =
                Model::groupBy(
                    Match::find('seasonid = ? order by week asc, matchid asc', [$this->season->seasonid]),
                    'week'
                );

            if ($csrf == $postCsrf) {
                for ($week=1; $week<=$totalWeeks; $week++) {
                    $name = HTMLResponse::fromPOST("week{$week}name");
                    $date = HTMLResponse::fromPOST("week{$week}date");
                    $this->season->setWeekName($week, $name);
                    $this->season->setWeekDate($week, $date);
                }
                $this->season->save();

                $newMatches = [];
                $oldMatches = [];
                for ($week=1; $week<=$this->season->getWeeksCount(); $week++) {
                    for ($i=0; $i<$maxMatches; $i++) {
                        $team1id = HTMLResponse::fromPOST("week{$week}match{$i}team1id");
                        $team2id = HTMLResponse::fromPOST("week{$week}match{$i}team2id");
                        if ($team1id === null || $team2id === null) continue;

                        $team1id *= 1;
                        $team2id *= 1;

                        if ($team1id && $team2id) {
                            if (isset($matches[$week][$i])) {
                                $match = $matches[$week][$i];
                                $match->team1id = "$team1id";
                                $match->team2id = "$team2id";
                                $oldMatches[] = $match;
                            }
                            else {
                                $match = Match::create();
                                $match->result = 0;
                                $match->week = $week;
                                $match->seasonid = $this->season->seasonid;
                                $match->team1id = $team1id;
                                $match->team2id = $team2id;
                                $newMatches[] = $match;
                            }
                        }
                        else {
                            if (isset($matches[$week][$i])) {
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:Admin_Season_Weeks.php

示例7: post_set_match_winner

 public function post_set_match_winner($matchId)
 {
     $bracket = Bracket::find(Session::get('bracketId'));
     $match = Match::find($matchId);
     // If the bracket doesn't exist
     // redirect back on home
     if (!$bracket) {
         return Redirect::home();
     }
     if (!$match) {
         return Redirect::to('bracket/tournament');
     }
     $homeScore = Input::get('teamScoreHome');
     $awayScore = Input::get('teamScoreAway');
     if ($homeScore < 5 && $awayScore < 5) {
         return Redirect::to('bracket/tournament')->with('error', 'Neither team has a high enough score to conclude the match.');
     }
     // Create the tournament object
     $tournament = new Tournament($bracket);
     $team = $homeScore > $awayScore ? $match->teams[0] : $match->teams[1];
     // advance this team to the next round or declare them the champ.
     $tournament->advanceTeam($match, $team);
     return Redirect::to('bracket/tournament');
 }
开发者ID:kleitz,项目名称:brackets,代码行数:24,代码来源:bracket.php

示例8: show

    /**
     * @return void
     */
    public function show()
    {
        $matches = Match::find('seasonid = ? and result != 0', [$this->season->seasonid]);
        $matches = Model::indexBy($matches, 'matchid');

        $teams = Model::indexBy(Team::find('1=1'), 'teamid');

        $matchWinner = [];

        foreach($matches as $match) {
            if ($this->season->weekIsPublished($match->week) && !$match->isDelayed()) {
                $matchWinner[$match->matchid] = $match->getWinner();
            }
        }

        $totalBets = [];
        $correctBets = [];

        $usernames = [];
        $avatars = Model::pluck(Avatar::find('1=1'), 'url', 'userid');

        foreach(Bet::find('1=1') as $bet) {
            if (isset($matchWinner[$bet->matchid])) {
                if ($bet->teamid && $matchWinner[$bet->matchid] == $bet->teamid) {
                    $correctBets[$bet->userid]++;
                }
                $totalBets[$bet->userid]++;
            }
            if ($bet->username) {
                $usernames[$bet->userid] = $bet->username;
            }
        }

        $tiebreakers = [];
        foreach(array_keys($correctBets) as $userid) {
            $tiebreakers[$userid] = [-$correctBets[$userid], $totalBets[$userid], strtolower($usernames[$userid])];
        }
        asort($tiebreakers);


        if (TwitterAuth::isLogged()) {
            $userid = TwitterAuth::getUserId();
            $userBets = Bet::find('userid = ? order by matchid desc', [$userid]);

            $userpos = array_search($userid, array_keys($tiebreakers));
            $userpos = ($userpos === FALSE) ? 0 : $userpos+1;

            ?>
            <div class="inblock" style="text-align: left; margin-right: 20px">
                <h2>Tus estadísticas</h2>
                <table>
                    <thead>
                    <tr>
                        <td>Puesto</td>
                        <td>Nombre</td>
                        <td>Aciertos</td>
                        <td>Fallos</td>
                    </tr>
                    </thead>
                    <tr>
                        <td><?= $userpos ?>º</td>
                        <td style="text-align: left">
                            <div class="inblock" style="vertical-align: middle">
                                <a href="http://twitter.com/<?=htmlentities($usernames[$userid])?>" target="_blank">
                                    <img src="<?= htmlentities($avatars[$userid]) ?>" style="width:40px; height:40px; border-radius: 20px">
                                </a>
                            </div>
                            <div class="inblock" style="vertical-align: middle">
                                <a href="http://twitter.com/<?=htmlentities($usernames[$userid])?>" target="_blank">
                                    <?= htmlentities($usernames[$userid]) ?>
                                    <? if (!isset($usernames[$userid])) echo "<i>$userid</i>"; ?>
                                </a>
                            </div>
                        </td>
                        <td><?= $correctBets[$userid] ?></td>
                        <td><?= $totalBets[$userid]-$correctBets[$userid] ?></td>
                    </tr>
                </table>

                <h2>Tus apuestas</h2>
                <table>
                    <thead>
                    <tr>
                        <td>Jornada</td>
                        <td>Enfrentamiento</td>
                        <td>Acierto</td>
                    </tr>
                    </thead>
                    <? foreach($userBets as $bet) {
                        if (!isset($matches[$bet->matchid])) continue;
                        /**
                         * @var $match Match
                         */
                        $match = $matches[$bet->matchid];
                        if (!$match->isPublished() || $match->isDelayed()) continue;

                        $team1 = $teams[$match->team1id];
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:BetsRanking.php

示例9: show

    /**
     * @return void
     */
    public function show()
    {
        $matches = Match::find('seasonid = ?', [$this->season->seasonid]);
        $wins = [];
        $games = [];
        $kills = [];
        $deaths = [];
        $mainPositions = [];
        $playoffsDefeat = [];
        $playoffsLast = [];

        foreach($this->season->getTeams() as $team) {
            $wins[$team->teamid] = 0;
            $kills[$team->teamid] = 0;
            $games[$team->teamid] = 0;
            $deaths[$team->teamid] = 0;
        }

        foreach($matches as $match) {
            if ($match->week > $this->season->mainweeks) continue;
            if (!$this->season->weekIsPublished($match->week)) continue;
            if ($match->isDelayed()) continue;

            $winner = $match->getWinner();
            if (!$winner) continue;
            $looser = $match->getLooser();

            $games[$winner]++;
            $games[$looser]++;

            $wins[$winner]++;

            $kills[$winner] += 6;
            $deaths[$looser] += 6;

            $looserKills = $match->getLooserKills();
            $kills[$looser] += $looserKills;
            $deaths[$winner] += $looserKills;
        }

        foreach(array_keys($kills) as $teamid) {
            $tiebreakers[$teamid] = array($wins[$teamid], $kills[$teamid]-$deaths[$teamid], $kills[$teamid], -$deaths[$teamid]);
        }
        arsort($tiebreakers);

        $lastPos = 0;
        $lastTiebreakers = null;
        foreach(array_keys($tiebreakers) as $pos => $teamid) {
            if ($lastTiebreakers != $tiebreakers[$teamid]) {
                $lastPos = $pos;
            }
            $mainPositions[$teamid] = $lastPos;
            $lastTiebreakers = $tiebreakers[$teamid];
        }

        foreach($matches as $match) {
            if ($match->week <= $this->season->mainweeks) continue;
            if (!$this->season->weekIsPublished($match->week)) continue;
            if ($match->isDelayed()) continue;

            $winner = $match->getWinner();
            if (!$winner) continue;
            $looser = $match->getLooser();

            $playoffsDefeat[$looser] = -$match->week;
            $playoffsLast[$winner] = $match->week;
            $playoffsLast[$looser] = $match->week;

            $playoffsPlayed[$winner] = 1;
            $playoffsPlayed[$looser] = 1;

            $games[$winner]++;
            $games[$looser]++;

            $wins[$winner]++;

            $kills[$winner] += 6;
            $deaths[$looser] += 6;

            $looserKills = $match->getLooserKills();
            $kills[$looser] += $looserKills;
            $deaths[$winner] += $looserKills;
        }

        foreach(array_keys($kills) as $teamid) {
            $tiebreakers[$teamid] = array($playoffsLast[$teamid]*1, $playoffsDefeat[$teamid]*1, -$mainPositions[$teamid]);
        }
        arsort($tiebreakers);


        ?>
        <table>
            <thead><tr>
                <td>Puesto</td>
                <td>Equipo</td>
                <td>Combates</td>
                <td>Victorias</td>
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:Ranking.php

示例10: postView

 public function postView()
 {
     $rules = array('id' => 'required|exists:matches,id', 'teamA_id' => 'required|integer|exists:teams,id', 'teamB_id' => 'required|integer|exists:teams,id', 'start_time' => 'required', 'rounds' => 'required|integer|min:1');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::action('Admin_MatchesController@getView', array(Input::get('id')))->withInput()->withErrors($validator);
     } else {
         $match = Match::find(Input::get('id'));
         $match->league_id = Input::get('league_id');
         $match->teamA_id = Input::get('teamA_id');
         $match->teamB_id = Input::get('teamB_id');
         $match->start_time = date("Y-m-d H:i:s", strtotime(Input::get('start_time')));
         $match->stream_url = Input::get('stream_url');
         $match->chat_url = Input::get('chat_url');
         $match->rounds = Input::get('rounds');
         $match->message = Input::get('message');
         $match->save();
         return Redirect::action('Admin_MatchesController@getIndex');
     }
 }
开发者ID:TsunamiNori,项目名称:Raffles,代码行数:20,代码来源:MatchesController.php

示例11: foreach

                        }
                    }
                }
            }
        }
    }
}
if (date('H') * 1 == 17 && date('i') * 1 < 15) {
    // 17:00 - 17:15
    // Videos
    foreach (Season::find('1=1') as $season) {
        $weeksCount = $season->getWeeksCount();
        for ($week = 1; $week <= $weeksCount; $week++) {
            if ($season->getWeekDate($week) == $date) {
                $weekName = $season->getWeekName($week);
                $matches = Match::find('seasonid = ? and week = ?', [$season->seasonid, $week]);
                foreach ($matches as $match) {
                    /** @var Team $team1 */
                    $team1 = $match->getTeam1();
                    /** @var Team $team2 */
                    $team2 = $match->getTeam2();
                    $video1 = Video::findOne('matchid = ? and teamid = ? and type = ?', [$match->matchid, $team1->teamid, 1]);
                    $video2 = Video::findOne('matchid = ? and teamid = ? and type = ?', [$match->matchid, $team2->teamid, 1]);
                    if ($video1 || $video2) {
                        $msg = "{$weekName} {$season->name}: #" . $team1->getHashtag() . " VS #" . $team2->getHashtag();
                        $msg .= " @{$team1->username} VS @{$team2->username}";
                        if ($video1) {
                            $msg .= " {$video1->link}";
                        }
                        if ($video2) {
                            $msg .= " {$video2->link}";
开发者ID:xJakub,项目名称:LCE,代码行数:31,代码来源:bot.php


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