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


PHP Stats::getRaw方法代码示例

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


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

示例1: showTables

    public static function showTables()
    {
        global $lng, $tours;
        title($lng->getTrn('name', 'LeagueTables'));
        // Selector for the tournament
        $tour_id = 0;
        if (isset($_POST['tour_id'])) {
            $tour_id = $_POST['tour_id'];
        } else {
            if (isset($_GET['tour_id'])) {
                $tour_id = $_GET['tour_id'];
            }
        }
        $firstTour = 0;
        ?>
    <div class='boxWide'>
        <h3 class='boxTitle2'><?php 
        echo $lng->getTrn('tours', 'LeagueTables');
        ?>
</h3>
        <div class='boxBody'>
			<form method="POST">
				<select name="tour_id">
					<?php 
        $rTours = array_reverse($tours, true);
        foreach ($rTours as $trid => $desc) {
            if ($firstTour == 0) {
                $firstTour = $trid;
            }
            echo "<option value='{$trid}'" . ($trid == $tour_id ? 'SELECTED' : '') . " >{$desc['tname']}</option>\n";
        }
        /*Replace the prior foreach with this once lid is known.
          foreach ($rTours as $trif => $desc) {
            if($firstTour == 0 && $lid == $_SESSION["NS_node_id"]) {
              $firstTour = $trid;
            }
            if($lid == $_SESSION["NS_node_id"]) {
              echo "<option value='$trid'" . ($trid==$tour_id ? 'SELECTED' : '') . " >$desc[tname]</option>\n";
            }
          }
          */
        ?>
				</select>
				<input type="submit" value="OK">
			</form>
        </div>
    </div>
    <?php 
        if ($tour_id == 0) {
            $tour_id = $firstTour;
        }
        // create the tournament and get the sorting rules
        $tour = new Tour($tour_id);
        $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule());
        // load all the teams according to the sorting rule
        list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array(T_NODE_TOURNAMENT => $tour_id), array(1, 1000), $SR, false);
        // Dump all the raw info for the first team as debug so I can work out the fields
        /*
        echo "<!--\n";
        foreach (array_keys($teams[0]) as $field) {
        	echo $field. "=" . $teams[0][$field] . "\n";
        }
        echo "-->\n";
        */
        // Hard coded list of fields to show - matching existing SLOBB/ECBBL league tables
        $fields = array($lng->getTrn('table-coach', 'LeagueTables') => 'f_cname', $lng->getTrn('table-name', 'LeagueTables') => 'name', $lng->getTrn('table-race', 'LeagueTables') => 'f_rname', $lng->getTrn('table-tv', 'LeagueTables') => 'tv', $lng->getTrn('table-played', 'LeagueTables') => 'mv_played', $lng->getTrn('table-won', 'LeagueTables') => 'mv_won', $lng->getTrn('table-draw', 'LeagueTables') => 'mv_draw', $lng->getTrn('table-loss', 'LeagueTables') => 'mv_lost', $lng->getTrn('table-td', 'LeagueTables') => 'mv_sdiff', $lng->getTrn('table-cas', 'LeagueTables') => 'mv_tcdiff', $lng->getTrn('table-points', 'LeagueTables') => 'mv_pts');
        $unplayedTeams = self::getUnplayedTeamsForTournament($tour_id);
        $confs = 0;
        if (Module::isRegistered('Conference')) {
            $confs = Conference::getConferencesForTour($tour_id);
        }
        // Now the clean output.
        ?>
	<div class='boxWide'>
		<h3 class='boxTitle<?php 
        echo T_HTMLBOX_STATS;
        ?>
'><?php 
        echo $tour->name;
        ?>
</h3>
<?php 
        if ($confs == 0 || empty($confs)) {
            // no conferences at all, or not for this league - normal format
            echo <<<EOQ
\t\t<div class='boxBody'>
\t\t\t<table class="boxTable">
EOQ;
            $i = 0;
            self::showHeader($fields);
            self::showPlayedTeams($teams, $fields, $i);
            self::showUnplayedTeams($unplayedTeams, $i);
            echo <<<EOQ
\t\t\t</table>
\t\t</div>
EOQ;
        } else {
            // conferences - so show them one at a time
            $allConfIds = array();
            foreach ($confs as $conf) {
//.........这里部分代码省略.........
开发者ID:TheNAF,项目名称:naflm,代码行数:101,代码来源:class_leaguetables.php

示例2: standings

 public static function standings($obj, $node, $node_id, array $opts)
 {
     /*
         Makes various kinds of standings tables.
         $obj and $node types are STATS_* types.
     
         $opts = array(
            'url' => page URL on which table is to be displayed (required!)
            'GET_SS' => GET Sorting suffix
            'return_objects' => bool
            'teams_from' => [T_OBJ_COACH|T_OBJ_RACE] when $obj = T_OBJ_TEAM and this is set, only teams related to this object type (teams_from), of ID = $opts[teams_from_id] are fetched.
            'teams_from_id' => ID (int) see "teams_from" for details.
         );
     */
     global $lng, $settings, $objFields_avg;
     $tblTitle = '';
     $objs = $fields = $extra = array();
     $fields_before = $fields_after = array();
     // To be merged with $fields.
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     $PAGE = isset($_GET["page"]) ? (int) $_GET["page"] : 1;
     $PAGELENGTH = 0;
     # Infinite, is overrided in below switch/case..
     $extra['noHelp'] = false;
     $W_TEAMS_FROM = array_key_exists('teams_from', $opts);
     $enableRaceSelector = $obj == T_OBJ_PLAYER || $obj == T_OBJ_TEAM && (!isset($opts['teams_from']) || $opts['teams_from'] != T_OBJ_RACE);
     # NO filters for teams of a coach on the coach's teams list.
     $_COACH_TEAM_LIST = $W_TEAMS_FROM && $opts['teams_from'] == T_OBJ_COACH;
     if ($_COACH_TEAM_LIST) {
         list(, , $T_STATE) = HTMLOUT::nodeSelector(array('nonodes' => true, 'state' => true));
         # Produces a state selector.
         $_SELECTOR = array(false, false, $T_STATE, T_RACE_ALL, 'GENERAL', 'mv_played', self::T_NS__ffilter_ineq_gt, 0);
     } else {
         $_SELECTOR = HTMLOUT::nodeSelector(array('force_node' => array($node, $node_id), 'race' => $enableRaceSelector, 'sgrp' => true, 'ffilter' => true, 'obj' => $obj));
     }
     list($sel_node, $sel_node_id, $sel_state, $sel_race, $sel_sgrp, $sel_ff_field, $sel_ff_ineq, $sel_ff_limit) = $_SELECTOR;
     $filter_node = array($sel_node => $sel_node_id);
     $filter_race = $sel_race != T_RACE_ALL ? array(T_OBJ_RACE => $sel_race) : array();
     $filter_having = array('having' => array($sel_ff_field . ($sel_ff_ineq == self::T_NS__ffilter_ineq_gt ? '>=' : '<=') . $sel_ff_limit));
     if ($_COACH_TEAM_LIST && $sel_state != T_STATE_ALLTIME) {
         $filter_having['having'][] = 'rdy IS TRUE';
         $filter_having['having'][] = 'retired IS FALSE';
     }
     $SGRP_GEN = $sel_sgrp == 'GENERAL';
     $ALL_TIME = self::_isNodeAllTime($obj, $sel_node, $sel_node_id);
     $manualSort = isset($_GET["sort{$opts['GET_SS']}"]);
     $sortRule = array_merge($manualSort ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $obj == T_OBJ_TEAM && $sel_node == T_NODE_TOURNAMENT && is_object($tr = new Tour($sel_node_id)) ? array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tr->getRSSortRule()) : sort_rule($obj));
     $set_avg = isset($_GET['pms']) && $_GET['pms'];
     // Per match stats?
     echo '<br><a href="' . $opts['url'] . '&amp;pms=' . ($set_avg ? 0 : 1) . '"><b>' . $lng->getTrn('common/' . ($set_avg ? 'ats' : 'pms')) . "</b></a><br><br>\n";
     // Common $obj type fields.
     $fields = self::_getDefFields($obj, $sel_node, $sel_node_id);
     // Was a different (non-general) stats group selected?
     if (!$SGRP_GEN) {
         $grps_short = getESGroups(true, true);
         $grps_long = getESGroups(true, false);
         $fields_short = $grps_short[$sel_sgrp];
         $fields_long = $grps_long[$sel_sgrp];
         $fields = array_combine(array_strpack('mv_%s', $fields_long), array_map(create_function('$f', 'return array("desc" => $f);'), $fields_short));
         $objFields_avg = array_merge($objFields_avg, array_map(create_function('$k', 'return substr($k, 3);'), array_keys($fields)));
     }
     switch ($obj) {
         case STATS_PLAYER:
             $tblTitle = $lng->getTrn('menu/statistics_menu/player_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/player'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, false, false, false), 'field' => 'obj_id', 'value' => 'player_id')), 'f_tname' => array('desc' => $lng->getTrn('common/team'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'owned_by_team_id')));
             $PAGELENGTH = $settings['standings']['length_players'];
             list($objs, $PAGES) = Stats::getRaw(T_OBJ_PLAYER, $filter_node + $filter_having + $filter_race, array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
             break;
         case STATS_TEAM:
             $tblTitle = $lng->getTrn('menu/statistics_menu/team_stn');
             $fields_before = array('name' => array('desc' => $lng->getTrn('common/name'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'team_id')));
             // Show teams standings list only for teams owned by... ?
             switch ($W_TEAMS_FROM ? $opts['teams_from'] : false) {
                 case T_OBJ_COACH:
                     $fields_before['f_rname'] = array('desc' => $lng->getTrn('common/race'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_RACE, false, false, false), 'field' => 'obj_id', 'value' => 'f_race_id'));
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + $filter_race + array(T_OBJ_COACH => (int) $opts['teams_from_id']), false, $sortRule, $set_avg);
                     break;
                 case T_OBJ_RACE:
                     $fields_before['f_cname'] = array('desc' => $lng->getTrn('common/coach'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_COACH, false, false, false), 'field' => 'obj_id', 'value' => 'owned_by_coach_id'));
                     $PAGELENGTH = $settings['standings']['length_teams'];
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + array(T_OBJ_RACE => (int) $opts['teams_from_id']), array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
                     break;
                     // All teams
                 // All teams
                 default:
                     $PAGELENGTH = $settings['standings']['length_teams'];
                     list($objs, $PAGES) = Stats::getRaw(T_OBJ_TEAM, $filter_node + $filter_having + $filter_race, array($PAGE, $PAGELENGTH), $sortRule, $set_avg);
             }
             // Translating race name
             foreach ($objs as &$o) {
                 $o['f_rname'] = $lng->getTrn('race/' . strtolower(str_replace(' ', '', $o['f_rname'])));
             }
             break;
         case STATS_RACE:
             $tblTitle = $lng->getTrn('menu/statistics_menu/race_stn');
//.........这里部分代码省略.........
开发者ID:nicholasmr,项目名称:obblm,代码行数:101,代码来源:class_htmlout.php

示例3: sec_main


//.........这里部分代码省略.........
                # Halt on these columns/fields.
                switch ($box['type']) {
                    case T_NODE_TOURNAMENT:
                        if (!get_alt_col('tours', 'tour_id', $box['id'], 'tour_id')) {
                            break 2;
                        }
                        $tour = new Tour($box['id']);
                        $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule());
                        break;
                    case T_NODE_DIVISION:
                        $_BAD_COLS = array('elo', 'swon', 'slost', 'sdraw', 'win_pct');
                        # Divisions do not have pre-calculated, MV, values of these fields.
                        // Fall through!
                    # Divisions do not have pre-calculated, MV, values of these fields.
                    // Fall through!
                    case T_NODE_LEAGUE:
                    default:
                        global $hrs;
                        $SR = $hrs[$box['HRS']]['rule'];
                        foreach ($SR as &$f) {
                            $field = substr($f, 1);
                            if (in_array($field, $_MV_RG_INTERSECT)) {
                                if (in_array($field, $_BAD_COLS)) {
                                    # E.g. divisions have no win_pct record for teams like the mv_teams table (for tours) has.
                                    fatal("Sorry, the element '{$field}' in your specified house sortrule #{$box['HRS']} is not supported for your chosen type (ie. tournament/division/league).");
                                }
                                $f = $f[0] . "rg_" . substr($f, 1);
                            } else {
                                $f = $f[0] . "mv_" . substr($f, 1);
                            }
                        }
                        break;
                }
                list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array($box['type'] => $box['id']), array(1, $box['length']), $SR, false);
                ?>
            <div class='boxWide'>
                <h3 class='boxTitle<?php 
                echo T_HTMLBOX_STATS;
                ?>
'><?php 
                echo $box['title'];
                ?>
</h3>
                <div class='boxBody'>
                    <table class="boxTable">
                        <?php 
                echo "<tr>\n";
                foreach ($box['fields'] as $title => $f) {
                    echo "<td><i>{$title}</i></td>\n";
                }
                echo "</tr>\n";
                foreach ($teams as $t) {
                    if (!$t['retired']) {
                        echo "<tr>\n";
                        foreach ($box['fields'] as $title => $f) {
                            if (in_array($f, $_MV_COLS)) {
                                $f = 'mv_' . $f;
                            }
                            echo "<td>";
                            if ($settings['fp_links'] && $f == 'name') {
                                echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t['team_id'], false, false) . "'>{$t['name']}</a>";
                            } elseif (is_numeric($t[$f]) && !ctype_digit($t[$f][0] == '-' ? substr($t[$f], 1) : $t[$f])) {
                                echo sprintf('%1.2f', $t[$f]);
                            } else {
                                echo in_array($f, array('tv')) ? $t[$f] / 1000 : $t[$f];
                            }
开发者ID:rythos42,项目名称:naflm,代码行数:67,代码来源:sections.php


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