當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。