Exemplo n.º 1
0
 function DrawTopOnlineTable($param1)
 {
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/SQL.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/VIP_.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/TopReset.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/TopOnline.php";
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/Rankings.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
     $acc = new Account($this->db);
     $rows = $param1;
     if ($TopOnlineMaxResults > 0 && $rows > $TopOnlineMaxResults) {
         return "";
     }
     $return = "\n\t\t<table class=\"RankingOnlineTable\">\n\t\t\t<tr>\n\t\t\t\t<th id=\"Position\">{$RankingMessage008}</th>\n\t\t\t\t<th id=\"Name\">{$RankingMessage009}</th>\n\t\t\t\t<th id=\"OnlineTime\">{$RankingMessage069}</th>\n\t\t\t\t<th id=\"Resets\">{$RankingMessage011}</th>\n\t\t\t\t";
     if ($TopOnlineShowClass) {
         $return .= "<th id=\"Class\">{$RankingMessage012}</th>";
     }
     if ($TopOnlineShowGuild) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Guild.class.php";
         $gd = new Guild();
         $guild = $gd->GetGuildMemberArray($this->db);
         $return .= "<th id=\"Guild\">{$RankingMessage013}</th>";
     }
     if ($TopOnlineShowStatus) {
         $OnlineCharacters = $acc->GetConnectedCharacters($this->db);
         $return .= "<th id=\"Status\">{$RankingMessage014}</th>";
     }
     if ($TopOnlineShowVip) {
         $return .= "<th id=\"Vip\">{$RankingMessage016}</th>";
     }
     $return .= "\n\t\t\t</tr>";
     if (!is_numeric($rows) && $rows != "*") {
         die;
     }
     if ($rows == "*") {
         $rows = "";
     } else {
         $rows = "TOP {$rows}";
     }
     $query = "\n\t\t\tSELECT {$rows} i.{$SQLVIPColumn} as Vip, c.Name, c.{$SQLResetsColumn} as Resets, c.Class, c.{$SQLOnlineTimeColumn} as Online, RANK() OVER(ORDER BY c.{$SQLOnlineTimeColumn} DESC) as Rank\n\t\t\tFROM Character as c, MEMB_INFO as i\n\t\t\tWHERE c.CtlCode < 8 AND c.AccountID = i.memb___id\n\t\t\tORDER BY c.{$SQLOnlineTimeColumn} DESC\n\t\t\t";
     $this->db->Query($query);
     $NumRows = $this->db->NumRows();
     for ($i = 0; $i < $NumRows; $i++) {
         $CharData[$i] = $this->db->GetRow();
     }
     for ($i = 0; $i < $NumRows; $i++) {
         $num = $i % 2 + 1;
         $data = $CharData[$i];
         if ($SQLOnlineTimeDivisor > 0) {
             $onlineTime = number_format($data['Online'] / $SQLOnlineTimeDivisor, 0, "", ".") . $SQLOnlineTimeSufix;
         } else {
             $onlineTime = number_format($data['Online'], 0, "", ".") . $SQLOnlineTimeSufix;
         }
         $return .= "\n\t\t\t\t<tr class=\"RankingOnlineTableRow{$num}\">\n\t\t\t\t<td id=\"Position\">" . $data['Rank'] . "{$RankingMessage017}</td>\n\t\t\t\t<td id=\"Name\"><a href=\"/" . $_SESSION['SiteFolder'] . "?c=CharInfo/" . $data['Name'] . "\">" . $data['Name'] . "</a></td>\n\t\t\t\t<td id=\"OnlineTime\">" . $onlineTime . "</td>\n\t\t\t\t<td id=\"Resets\">" . $data['Resets'] . "</td>\n\t\t\t\t";
         if ($TopOnlineShowClass) {
             require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Character.class.php";
             $ch = new Character();
             $class = $ch->GetClassName($data['Class'], $TopOnlineShowClassMode);
             $return .= "<td id=\"Class\">" . $class . "</td>";
         }
         if ($TopOnlineShowGuild) {
             if (!empty($guild[$data['Name']])) {
                 $guildName = $guild[$data['Name']];
             } else {
                 $guildName = "-";
             }
             $return .= "<td id=\"Guild\">" . $guildName . "</td>";
         }
         if ($TopOnlineShowStatus) {
             $status = in_array($data['Name'], $OnlineCharacters) ? $RankingMessage018 : $RankingMessage019;
             $return .= "<td id=\"Status\">" . $status . "</td>";
         }
         if ($TopOnlineShowVip) {
             $vip = $data['Vip'];
             $vip = $acc->GetVipName($vip);
             $return .= "<td id=\"Vip\">{$vip}</td>";
         }
         $return .= "\n\t\t\t</tr>";
     }
     $return .= "</table>";
     return $return;
 }