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


PHP TimeDate::secToStringTime方法代码示例

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


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

示例1: getCurrentServerInfo

 /**
  * Récupère les informations du serveur actuel (map, serveur, stats, joueurs)
  *
  * @param string $sortBy -> Le tri à faire sur la liste
  * @return array
  */
 public static function getCurrentServerInfo($sortBy = null)
 {
     global $client;
     $out = array();
     // JEU
     if (SERVER_VERSION_NAME == 'TmForever') {
         $queryName = array('getMapInfo' => 'GetCurrentChallengeInfo');
     } else {
         $queryName = array('getMapInfo' => 'GetCurrentMapInfo');
     }
     // REQUÊTES
     $client->addCall($queryName['getMapInfo']);
     if (AdminServAdminLevel::isType('Admin')) {
         $client->addCall('GetMapsDirectory');
     }
     $client->addCall('GetGameMode');
     $client->addCall('GetServerName');
     $client->addCall('GetStatus');
     $client->addCall('GetCurrentCallVote');
     if (AdminServAdminLevel::isType('SuperAdmin')) {
         $client->addCall('GetNetworkStats');
     }
     $client->addCall('GetPlayerList', array(AdminServConfig::LIMIT_PLAYERS_LIST, 0, 1));
     if (!$client->multiquery()) {
         $out['error'] = Utils::t('Client not initialized');
     } else {
         // DONNÉES DES REQUÊTES
         $queriesData = $client->getMultiqueryResponse();
         // GameMode
         $out['srv']['gameModeId'] = $queriesData['GetGameMode'];
         $out['srv']['gameModeName'] = self::getGameModeName($out['srv']['gameModeId']);
         $out['srv']['gameModeScriptName'] = null;
         if (self::isGameMode('Script', $out['srv']['gameModeId'])) {
             $client->query('GetModeScriptInfo');
             $getModeScriptInfo = $client->getResponse();
             if (isset($getModeScriptInfo['Name'])) {
                 $out['srv']['gameModeScriptName'] = self::formatScriptName($getModeScriptInfo['Name']);
             }
         }
         $displayTeamMode = self::checkDisplayTeamMode($out['srv']['gameModeId'], $out['srv']['gameModeScriptName']);
         // CurrentMapInfo
         $currentMapInfo = $queriesData[$queryName['getMapInfo']];
         $out['map']['name'] = TmNick::toHtml($currentMapInfo['Name'], 10, true, false, '#999');
         $out['map']['uid'] = $currentMapInfo['UId'];
         $out['map']['author'] = $currentMapInfo['Author'];
         $out['map']['enviro'] = $currentMapInfo['Environnement'];
         // MapThumbnail
         $out['map']['thumb'] = null;
         if (isset($queriesData['GetMapsDirectory']) && $currentMapInfo['FileName'] != null) {
             $mapFileName = $queriesData['GetMapsDirectory'] . $currentMapInfo['FileName'];
             if (file_exists($mapFileName)) {
                 if (SERVER_VERSION_NAME == 'TmForever') {
                     $Gbx = new GBXChallengeFetcher($queriesData['GetMapsDirectory'] . $currentMapInfo['FileName'], false, true);
                 } else {
                     $Gbx = new GBXChallMapFetcher(false, true);
                     $Gbx->processFile($queriesData['GetMapsDirectory'] . $currentMapInfo['FileName']);
                 }
                 $out['map']['thumb'] = base64_encode($Gbx->thumbnail);
             }
         }
         // CurrentCallVote
         $out['map']['callvote']['login'] = $queriesData['GetCurrentCallVote']['CallerLogin'];
         $out['map']['callvote']['cmdname'] = $queriesData['GetCurrentCallVote']['CmdName'];
         $out['map']['callvote']['cmdparam'] = $queriesData['GetCurrentCallVote']['CmdParam'];
         // TeamScores (mode team)
         if (self::isGameMode('Team', $out['srv']['gameModeId'])) {
             $client->query('GetCurrentRanking', 2, 0);
             $currentRanking = $client->getResponse();
             $out['map']['scores']['blue'] = $currentRanking[0]['Score'];
             $out['map']['scores']['red'] = $currentRanking[1]['Score'];
         }
         // ServerName
         $out['srv']['name'] = TmNick::toHtml($queriesData['GetServerName'], 10, true, false, '#999');
         // Status
         $out['srv']['status'] = $queriesData['GetStatus']['Name'];
         // NetworkStats
         if (isset($queriesData['GetNetworkStats']) && count($queriesData['GetNetworkStats']) > 0) {
             $networkStats = $queriesData['GetNetworkStats'];
             $out['net']['uptime'] = TimeDate::secToStringTime($networkStats['Uptime'], false);
             $out['net']['nbrconnection'] = $networkStats['NbrConnection'];
             $out['net']['meanconnectiontime'] = TimeDate::secToStringTime($networkStats['MeanConnectionTime'], false);
             $out['net']['meannbrplayer'] = $networkStats['MeanNbrPlayer'];
             $out['net']['recvnetrate'] = $networkStats['RecvNetRate'];
             $out['net']['sendnetrate'] = $networkStats['SendNetRate'];
             $out['net']['totalreceivingsize'] = $networkStats['TotalReceivingSize'];
             $out['net']['totalsendingsize'] = $networkStats['TotalSendingSize'];
         } else {
             $out['net'] = null;
         }
         // PlayerList
         $playerList = $queriesData['GetPlayerList'];
         $countPlayerList = count($playerList);
         if ($countPlayerList > 0) {
             $client->query('GetCurrentRanking', AdminServConfig::LIMIT_PLAYERS_LIST, 0);
//.........这里部分代码省略.........
开发者ID:keverage,项目名称:adminserv,代码行数:101,代码来源:adminserv.php


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