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


PHP Match::match_players_update方法代码示例

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


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

示例1: switch

             $q = "INSERT INTO " . TBL_SCORES . "(MatchID,Player,Player_MatchTeam,Player_Score,Player_Rank,Faction,Color,sColor,APM)\r\n\t\t\t\t\t\t\tVALUES (\r\n\t\t\t\t\t\t\t{$match_id},\r\n\t\t\t\t\t\t\t'" . $scores[$i]['Player'] . "',\r\n\t\t\t\t\t\t\t'" . $scores[$i]['Player_MatchTeam'] . "',\r\n\t\t\t\t\t\t\t0,\r\n\t\t\t\t\t\t\t'" . $scores[$i]['Player_Rank'] . "',\r\n\t\t\t\t\t\t\t'" . $scores[$i]['Faction'] . "',\r\n\t\t\t\t\t\t\t'" . $scores[$i]['Color'] . "',\r\n\t\t\t\t\t\t\t'" . $scores[$i]['sColor'] . "',\r\n\t\t\t\t\t\t\t'" . $scores[$i]['APM'] . "'\r\n\t\t\t\t\t\t\t)";
             break;
         case 'Teams':
             break;
         default:
             $q = '';
     }
     $result = $sql->db_Query($q);
 }
 // Update scores stats
 $match->match_scores_update();
 // Automatically Update Players stats only if Match Approval is Disabled
 if ($event->getField('MatchesApproval') == eb_UC_NONE) {
     switch ($event->getMatchPlayersType()) {
         case 'Players':
             $match->match_players_update();
             break;
         case 'Teams':
             $match->match_teams_update();
             break;
         default:
     }
 }
 $event->setFieldDB('IsChanged', 1);
 // Save the replay
 $target_path = "uploads/";
 $target_file = $target_path . basename($name);
 move_uploaded_file($tmpname, $target_file);
 $raw_name = urlencode($name);
 $target_file = $target_path . basename($raw_name);
 $media_type = 'Replay';
开发者ID:testt98,项目名称:ebattles,代码行数:31,代码来源:submitreplay.php

示例2: eventScoresUpdate

 /**
  * eventScoresUpdate - Re-calculate the scores and players of an event
  */
 function eventScoresUpdate($current_match)
 {
     global $sql;
     global $time;
     //echo "dbg: current_match $current_match<br>";
     $numMatchsPerUpdate = 10;
     $q = "SELECT " . TBL_MATCHS . ".*" . " FROM " . TBL_MATCHS . " WHERE (" . TBL_MATCHS . ".Event = '" . $this->fields['EventID'] . "')" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " ORDER BY TimeReported";
     $result = $sql->db_Query($q);
     $num_matches = mysql_numrows($result);
     if ($current_match > $num_matches) {
         switch ($this->fields['Type']) {
             case "One Player Ladder":
                 updateStats($this->fields['EventID'], $time, true);
                 break;
             case "Team Ladder":
                 updateStats($this->fields['EventID'], $time, true);
                 updateTeamStats($this->fields['EventID'], $time, true);
                 break;
             case "Clan Ladder":
                 updateTeamStats($this->fields['EventID'], $time, true);
                 break;
             case "One Player Tournament":
             case "Clan Tournament":
                 break;
             default:
         }
         echo "Done.";
         echo '<META HTTP-EQUIV="Refresh" Content="0; URL=eventmanage.php?eventid=' . $this->fields['EventID'] . '">';
     } else {
         $next_match = 1;
         if ($current_match == 0) {
             // Reset players stats
             $this->resetPlayers();
             $this->resetTeams();
             switch ($this->fields['Type']) {
                 case "One Player Ladder":
                     updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     break;
                 case "Team Ladder":
                     updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                     break;
                 case "Clan Ladder":
                     updateTeamStats($this->fields['EventID'], $this->fields['getStartDateTime'], false);
                     break;
                 case "One Player Tournament":
                 case "Clan Tournament":
                     break;
                 default:
             }
         } else {
             if (ob_get_level() == 0) {
                 ob_start();
             }
             // Output a 'waiting message'
             echo str_pad('Please wait while this task completes... ', 4096) . "<br />\n";
             // Update matchs scores
             for ($j = $current_match - 1; $j < min($current_match + $numMatchsPerUpdate - 1, $num_matches); $j++) {
                 set_time_limit(10);
                 $next_match = $j + 2;
                 $match_id = mysql_result($result, $j, TBL_MATCHS . ".MatchID");
                 $match = new Match($match_id);
                 $time_reported = mysql_result($result, $j, TBL_MATCHS . ".TimeReported");
                 //echo "dbg: match: $match_id<br>";
                 //echo "dbg: etype: $this->fields['Type']<br>";
                 $match->match_scores_update();
                 switch ($this->fields['Type']) {
                     case "One Player Ladder":
                         $match->match_players_update();
                         updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "Team Ladder":
                         $match->match_players_update();
                         updateStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "Clan Ladder":
                         $match->match_teams_update();
                         updateTeamStats($this->fields['EventID'], $this->fields['StartDateTime'], false);
                         break;
                     case "One Player Tournament":
                     case "Clan Tournament":
                         break;
                     default:
                 }
                 //echo 'match '.$j.': '.$match_id.'<br>';
                 //echo '<div class="percents">match '.$j.': '.$match_id.'</div>';
                 echo '<div class="percents">' . number_format(100 * ($j + 1) / $num_matches, 0, '.', '') . '%&nbsp;complete</div>';
                 echo str_pad('', 4096) . "\n";
                 ob_flush();
                 flush();
             }
         }
         echo '<form name="updateform" action="' . e_PLUGIN . 'ebattles/eventprocess.php?eventid=' . $this->fields['EventID'] . '" method="post">';
         echo '<input type="hidden" name="match" value="' . $next_match . '"/>';
         echo '<input type="hidden" name="eventupdatescores" value="1"/>';
         echo '</form>';
//.........这里部分代码省略.........
开发者ID:testt98,项目名称:ebattles,代码行数:101,代码来源:event.php


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