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


PHP Match::getField方法代码示例

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


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

示例1: brackets

    function brackets($scheduleNextMatches = false, $delete_match_id = 0, $style = '')
    {
        global $sql;
        global $time;
        global $pref;
        global $tp;
        global $gold_obj;
        $this->updateFields();
        $type = $this->fields['Type'];
        $competition_type = $this->getCompetitionType();
        $format = $this->fields['Format'];
        $event_id = $this->fields['EventID'];
        $teams = $this->getTeams();
        //var_dump($teams);
        $results = unserialize($this->getFieldHTML('Results'));
        $update_results = false;
        // TODO: check for error (return false)
        $rounds = unserialize($this->getFieldHTML('Rounds'));
        $matchups = $this->getMatchups();
        $nbrRounds = count($matchups);
        $nbrRows = 4 * count($matchups[1]);
        /* */
        $brackets = array();
        $content = array();
        // Initialize grid
        for ($row = 1; $row <= $nbrRows; $row++) {
            for ($column = 1; $column <= $nbrRounds; $column++) {
                $brackets[$row][2 * $column - 1] = '<td class="grid empty"></td>';
                $brackets[$row][2 * $column] = '<td class="grid border-none"></td>';
            }
        }
        $rowspan = 1;
        for ($round = 1; $round <= $nbrRounds; $round++) {
            $nbrMatchups = count($matchups[$round]);
            $rounds[$round]['nbrMatchups'] = 0;
            if ($round < $nbrRounds) {
                for ($matchup = 1; $matchup <= $nbrMatchups; $matchup++) {
                    if (!isset($results[$round][$matchup]['matchs'])) {
                        $results[$round][$matchup]['winner'] = 'not played';
                        $results[$round][$matchup]['bye'] = false;
                    }
                    if (!isset($results[$round][$matchup]['winner'])) {
                        $results[$round][$matchup]['winner'] = 'not played';
                    }
                    if (!isset($results[$round][$matchup]['bye'])) {
                        $results[$round][$matchup]['bye'] = false;
                    }
                    if (!isset($matchups[$round][$matchup]['deleted'])) {
                        $matchups[$round][$matchup]['deleted'] = false;
                    }
                    /* Nbr of matches in the matchup */
                    $nbr_matchs = count($results[$round][$matchup]['matchs']);
                    $matchup_deleted = false;
                    for ($match = 0; $match < 2; $match++) {
                        $matchupString = $matchups[$round][$matchup][$match];
                        $content[$round][$matchup][$match] = $matchupString == '' ? 'E' : $matchupString;
                        if ($matchupString == '') {
                            $row = findRow($round, $matchup, $match, $style);
                            $matchupsRows[$round][$matchup][$match] = $row;
                        } else {
                            if ($matchupString[0] == 'T') {
                                $row = findRow($round, $matchup, $match, $style);
                                $matchupsRows[$round][$matchup][$match] = $row;
                                $team = substr($matchupString, 1);
                                if (empty($teams[$team - 1])) {
                                    $content[$round][$matchup][$match] = 'E';
                                }
                            }
                            if ($matchupString[0] == 'W') {
                                $matchupArray = explode(',', substr($matchupString, 1));
                                $matchupRound = $matchupArray[0];
                                $matchupMatchup = $matchupArray[1];
                                // Get result of matchup
                                $winner = $results[$matchupRound][$matchupMatchup]['winner'];
                                $bye = $results[$matchupRound][$matchupMatchup]['bye'];
                                $deleted = $matchups[$matchupRound][$matchupMatchup]['deleted'];
                                $rowTop = $matchupsRows[$matchupRound][$matchupMatchup][0];
                                $rowBottom = $matchupsRows[$matchupRound][$matchupMatchup][1];
                                $row = ($rowBottom - $rowTop) / 2 + $rowTop;
                                // If result is not a bye, we draw the grid
                                if ($bye != true) {
                                    $brackets[$rowTop][2 * $round - 2] = '<td class="grid border-top"></td>';
                                    $brackets[$rowBottom][2 * $round - 2] = '<td class="grid border-bottom"></td>';
                                    for ($i = $rowTop + 1; $i < $rowBottom; $i++) {
                                        $brackets[$i][2 * $round - 2] = '<td class="grid border-vertical"></td>';
                                    }
                                    for ($i = $rowTop + 2; $i < $rowBottom; $i++) {
                                        $brackets[$i][2 * $round - 3] = '';
                                    }
                                    $brackets[$row][2 * $round - 2] = '<td class="grid border-middle"></td>';
                                }
                                $matchupsRows[$round][$matchup][$match] = $row;
                                if ($winner == 'top') {
                                    $content[$round][$matchup][$match] = $content[$matchupRound][$matchupMatchup][0];
                                } else {
                                    if ($winner == 'bottom') {
                                        $content[$round][$matchup][$match] = $content[$matchupRound][$matchupMatchup][1];
                                    } else {
                                        // Not played
                                        // Detect if match has been previously scheduled and needs to be deleted
//.........这里部分代码省略.........
开发者ID:testt98,项目名称:ebattles,代码行数:101,代码来源:event.php

示例2: displayRecentActivity

/**
* displayRecentActivity - Displays Recent Activity
*/
function displayRecentActivity($event_id)
{
    global $sql;
    global $time;
    global $pref;
    $events = array();
    $nbr_events = 0;
    if ($event_id != '') {
        $eventid_match = " AND (" . TBL_MATCHS . ".Event = '{$event_id}')";
        $eventid_award = " AND (" . TBL_EVENTS . ".EventID = '{$event_id}')";
    }
    // Add recent games
    $rowsPerPage = $pref['eb_activity_number_of_items'];
    /* Stats/Results */
    $q = "SELECT DISTINCT " . TBL_MATCHS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . $eventid_match . " ORDER BY " . TBL_MATCHS . ".TimeReported DESC" . " LIMIT 0, {$rowsPerPage}";
    $result = $sql->db_Query($q);
    $num_rows = mysql_numrows($result);
    if ($num_rows > 0) {
        /* Display table contents */
        for ($i = 0; $i < $num_rows; $i++) {
            $match_id = mysql_result($result, $i, TBL_MATCHS . ".MatchID");
            $match = new Match($match_id);
            $events[$nbr_events][0] = $match->getField('TimeReported');
            $events[$nbr_events][1] = $match->displayMatchInfo(eb_MATCH_NO_EDIT_ICONS);
            $nbr_events++;
        }
    }
    // Add Awards events
    $q = "SELECT " . TBL_AWARDS . ".*, " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*, " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_AWARDS . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . ", " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_AWARDS . ".Player = " . TBL_PLAYERS . ".PlayerID)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_GAMERS . ".User = " . TBL_USERS . ".user_id)" . " AND (" . TBL_PLAYERS . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $eventid_award . " ORDER BY " . TBL_AWARDS . ".timestamp DESC" . " LIMIT 0, {$rowsPerPage}";
    $result = $sql->db_Query($q);
    $numAwards = mysql_numrows($result);
    if ($numAwards > 0) {
        /* Display table contents */
        for ($i = 0; $i < $numAwards; $i++) {
            $aID = mysql_result($result, $i, TBL_AWARDS . ".AwardID");
            $aUser = mysql_result($result, $i, TBL_USERS . ".user_id");
            $gamer_id = mysql_result($result, $i, TBL_PLAYERS . ".Gamer");
            $gamer = new Gamer($gamer_id);
            $aUserNickName = $gamer->getField('Name');
            $aEventgame = mysql_result($result, $i, TBL_GAMES . ".Name");
            $aEventgameicon = mysql_result($result, $i, TBL_GAMES . ".Icon");
            $aType = mysql_result($result, $i, TBL_AWARDS . ".Type");
            $aTime = mysql_result($result, $i, TBL_AWARDS . ".timestamp");
            $aTime_local = $aTime + TIMEOFFSET;
            $date = date("d M Y, h:i A", $aTime_local);
            $aEventID = mysql_result($result, $i, TBL_EVENTS . ".EventID");
            $aEventName = mysql_result($result, $i, TBL_EVENTS . ".Name");
            switch ($aType) {
                case 'PlayerTookFirstPlace':
                    $award = EB_AWARD_L2;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/award_star_gold_3.png") . ' alt="' . EB_AWARD_L3 . '" title="' . EB_AWARD_L3 . '"/> ';
                    break;
                case 'PlayerInTopTen':
                    $award = EB_AWARD_L4;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/award_star_bronze_3.png") . ' alt="' . EB_AWARD_L5 . '" title="' . EB_AWARD_L5 . '"/> ';
                    break;
                case 'PlayerStreak5':
                    $award = EB_AWARD_L6;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_bronze_3.png") . ' alt="' . EB_AWARD_L7 . '" title="' . EB_AWARD_L7 . '"/> ';
                    break;
                case 'PlayerStreak10':
                    $award = EB_AWARD_L8;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_silver_3.png") . ' alt="' . EB_AWARD_L9 . '" title="' . EB_AWARD_L9 . '"/> ';
                    break;
                case 'PlayerStreak25':
                    $award = EB_AWARD_L10;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_gold_3.png") . ' alt="' . EB_AWARD_L11 . '" title="' . EB_AWARD_L11 . '"/> ';
                    break;
                case 'PlayerWonTournament':
                    $award = EB_AWARD_L12;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/trophy_gold.png") . ' alt="' . EB_AWARD_L13 . '" title="' . EB_AWARD_L13 . '"/> ';
                    break;
                case 'PlayerRankFirst':
                    $award = EB_AWARD_L14;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_gold_1.png") . ' alt="' . EB_AWARD_L15 . '" title="' . EB_AWARD_L15 . '"/> ';
                    break;
                case 'PlayerRankSecond':
                    $award = EB_AWARD_L16;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_silver_1.png") . ' alt="' . EB_AWARD_L17 . '" title="' . EB_AWARD_L17 . '"/> ';
                    break;
                case 'PlayerRankThird':
                    $award = EB_AWARD_L18;
                    $icon = '<img ' . getActivityIconResize(e_PLUGIN . "ebattles/images/awards/medal_bronze_1.png") . ' alt="' . EB_AWARD_L19 . '" title="' . EB_AWARD_L19 . '"/> ';
                    break;
            }
            $award_string = '<tr><td style="vertical-align:top">' . $icon . '</td>';
            $award_string .= '<td><a href="' . e_PLUGIN . 'ebattles/userinfo.php?user=' . $aUser . '">' . $aUserNickName . '</a>';
            $award_string .= ' ' . $award;
            $award_string .= ' ' . EB_MATCH_L12 . ' <img ' . getActivityGameIconResize($aEventgameicon) . ' title="' . $aEventgame . '"/>&nbsp;<a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $aEventID . '">' . $aEventName . '</a>';
            $award_string .= ' <div class="smalltext">';
            if ($time - $aTime < INT_MINUTE) {
                $award_string .= EB_MATCH_L7;
            } else {
                if ($time - $aTime < INT_DAY) {
                    $award_string .= get_formatted_timediff($aTime, $time) . '&nbsp;' . EB_MATCH_L8;
                } else {
                    $award_string .= $date;
//.........这里部分代码省略.........
开发者ID:testt98,项目名称:ebattles,代码行数:101,代码来源:eb_activity_menu.php

示例3: count

                    }
                }
            }
            if ($found_match == 1) {
                $text .= '<b>' . $rounds[$round]['Title'] . '</b>';
                $text .= ' (' . EB_EVENTM_L146 . ' ' . $rounds[$round]['BestOf'] . ')';
                $text .= '<table class="table_left">';
                for ($matchup = 1; $matchup <= $nbrMatchups; $matchup++) {
                    $nbrMatchs = count($results[$round][$matchup]['matchs']);
                    $text_add = '';
                    $nbrMatchsScheduled = 0;
                    for ($match = 0; $match < $nbrMatchs; $match++) {
                        $current_match = $results[$round][$matchup]['matchs'][$match];
                        $match_id = $current_match['match_id'];
                        $matchObj = new Match($match_id);
                        if ($matchObj->getField('Status') == 'scheduled') {
                            $nbrMatchsScheduled++;
                            $text_add .= $matchObj->displayMatchInfo(eb_MATCH_NOEVENTINFO | eb_MATCH_SCHEDULED, EB_MATCH_L1 . '&nbsp;' . ($match + 1) . '&nbsp;');
                        }
                    }
                    if ($nbrMatchsScheduled > 0) {
                        $text .= '<tr><td><b>' . EB_EVENT_L102 . ' ' . $matchup . '</b></td></tr>';
                    }
                    $text .= $text_add;
                }
                $text .= '</table>';
            }
        }
    }
}
$text .= '</div>';
开发者ID:testt98,项目名称:ebattles,代码行数:31,代码来源:tournamentinfo.php


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