source: branches/old/arena.php

Last change on this file was 448, checked in by george, 16 years ago
  • Přesunuto: Obsah kořenové složky byl přesunut do složky trunk a beta web přesunut do branches/beta.
File size: 3.7 KB
Line 
1<?php
2
3include('global.php');
4ShowHeader();
5$Database->select_db('characters');
6require_once("minimanager/lang/czech.php");
7require_once("minimanager/scripts/defines.php");
8require_once("minimanager/scripts/id_tab.php");
9
10echo('<h3>Arénové týmy:</h3><div align="center">');
11if(!array_key_exists('order_by2', $_SESSION)) $_SESSION['order_by2'] = 'rating';
12if(array_key_exists('order_by', $_GET)) $_SESSION['order_by2'] = $Database->real_escape_string($_GET['order_by']);
13$order_by = $_SESSION['order_by2'];
14
15 if(!array_key_exists('dir2', $_SESSION)) $_SESSION['dir2'] = 1;
16 if(array_key_exists('dir', $_GET)) $_SESSION['dir2'] = $Database->real_escape_string($_GET['dir']);
17 $dir = $_SESSION['dir2'];
18 $dir = ($dir) ? 0 : 1;
19 $order_dir = ($dir) ? "ASC" : "DESC";
20
21 $PerPage = 20;
22 if(array_key_exists('page', $_GET)) $_SESSION['page2'] = $Database->real_escape_string($_GET['page']);
23 if(array_key_exists('page', $_SESSION)) $Page = $_SESSION['page2']; else $Page = 0;
24
25 $itemperpage = 30;
26 $DbResult = $Database->query("SELECT count(*) FROM arena_team");
27 $Row = $DbResult->fetch_array();
28 $all_record = $Row[0];
29
30 $query = $Database->query("SELECT arena_team.arenateamid AS atid, arena_team.name AS atname, arena_team.captainguid AS lguid, arena_team.type AS attype, (SELECT name FROM `characters` WHERE guid = lguid) AS l_name,(SELECT COUNT(*) FROM arena_team_member WHERE arenateamid = atid) AS tot_chars, rating AS atrating, games as atgames, wins as atwins FROM arena_team, arena_team_stats WHERE arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY $order_by $order_dir LIMIT ".($Page * $PerPage).",".$PerPage);
31echo($Database->error);
32 $this_page = $query->num_rows;
33
34 $output = "<font class=\"bold\">Celkem týmů: $all_record</font><br />";
35 $output .= "<table class=\"TableGuilda\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
36 <tr>
37 <th width=\"22%\"><a href=\"?order_by=atname&amp;dir=$dir\">".($order_by=='atname' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['arenateam_name']}</a></th>
38 <th width=\"10%\"><a href=\"?order_by=tot_chars&amp;dir=$dir\">".($order_by=='tot_chars' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['captain']}</a></th>
39 <th width=\"7%\"><a href=\"?order_by=attype&amp;dir=$dir\">".($order_by=='attype' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['type']}</a></th>
40 <th width=\"7%\"><a href=\"?order_by=membres&amp;dir=$dir\">".($order_by=='members' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['members']}</a></th>
41 <th width=\"7%\"><a href=\"?order_by=rating&amp;dir=$dir\">".($order_by=='rating' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['rating']}</a></th>
42 <th width=\"7%\"><a href=\"?order_by=games&amp;dir=$dir\">".($order_by=='games' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['games']}</a></th>
43 <th width=\"7%\"><a href=\"?order_by=wins&amp;dir=$dir\">".($order_by=='wins' ? "<img src=\"images/online_player/arr_".($dir ? "up" : "dw").".gif\" /> " : "")."{$lang_arenateam['wins']}</a></th>
44 </tr>";
45
46while ($data = $query->fetch_assoc())
47{
48 $output .= "<tr>
49 <td>".$data['atname']."</td>
50 <td>".$data['l_name']."</td>
51 <td>".$lang_arenateam[$data['attype']]."</td>
52 <td>".$data['tot_chars']."</td>
53 <td>".$data['atrating']."</td>
54 <td>".$data['atgames']."</td>
55 <td>".$data['atwins']."</td>
56 </tr>";
57}
58
59 $output .= "</table>".PagesList('?page=', $Page, $all_record, $PerPage)."</center>";
60 echo($output);
61 ShowFooter();
62
63?>
Note: See TracBrowser for help on using the repository browser.