Changeset 582 for trunk/pages/arena.php
- Timestamp:
- May 4, 2009, 9:38:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pages/arena.php
r407 r582 1 1 <?php 2 // razeni 3 $order_by = (isset($_GET["order"])) ? $db->real_escape_string($_GET["order"]) : "name"; 4 $dir = (isset($_GET["dir"])) ? $db->real_escape_string($_GET["dir"]) : "down"; 5 $order_dir = ($dir == "up") ? "ASC" : "DESC"; 6 $dir = ($dir == "down") ? "up" : "down"; 7 $dir_img = ($dir == "down") ? "<img src=\"imgs/inc/up.gif\">" : "<img src=\"imgs/inc/down.gif\">"; 8 function MakeLink ($show,$sort) 2 3 $Columns = array('name', 'atname', 'attype', 'tot_chars', 'atrating', 'atwin', 'atgames'); 4 $order_by = (isset($_GET['order'])) ? $_GET['order'] : 'atname'; 5 if(!array_key_exists($order_by, $Columns)) $order_by = 'atname'; 6 $dir = (isset($_GET['dir'])) ? $_GET['dir'] : 'down'; 7 $order_dir = ($dir == 'up') ? 'ASC' : 'DESC'; 8 $dir = ($dir == 'down') ? 'up' : 'down'; 9 $dir_img = ($dir == 'down') ? '<img src="imgs/inc/up.gif" alt="nahoru"/>' : '<img src="imgs/inc/down.gif" alt="dolu">'; 10 11 function MakeLink($show, $sort) 9 12 { 10 global $dir , $dir_img; 11 if (isset($_GET["order"]) AND $_GET["order"] == $sort) 12 { 13 $arrow = $dir_img.""; 14 } 15 else 16 { 17 $arrow = ""; 18 } 19 return $arrow."<a href=\"?page=arena&order=".$sort."&dir=".$dir."\">".$show."</a>"; 20 } 21 include("inc/db.php"); 22 $db -> select_db("$db_characters"); 23 $count = $db -> query("SELECT count(*) FROM arena_team;") -> fetch_array(); 13 global $dir, $dir_img; 14 15 if(isset($_GET['order']) and $_GET['order'] == $sort) $arrow = $dir_img; 16 else $arrow = ''; 17 return($arrow.'<a href="?page=arena&order='.$sort.'&dir='.$dir.'">'.$show.'</a>'); 18 } 19 20 $db->select_db($Config['Mangos']['DatabaseCharacters']); 21 $count = $db->query('SELECT COUNT(*) FROM arena_team')->fetch_row(); 24 22 $all_record = $count[0]; 25 echo " 26 <center><h3>Arénové týmy :</h3></center> 27 Celkem týmů : <b>".$all_record."</b> 23 echo('<center><h3>Arénové týmy :</h3></center> 24 Celkem týmů : <b>'.$all_record.'</b> 28 25 <center> 29 <table border= \"1\" width=\"540\">26 <table border="1" width="540"> 30 27 <tr> 31 <th> ".MakeLink("Tým","atname")."</th>28 <th>'.MakeLink('Tým', 'atname').'</th> 32 29 <th>Kapitán</th> 33 <th>".MakeLink("Typ","attype")."</th> 34 <th>".MakeLink("Členů","tot_chars")."</th> 35 <th>".MakeLink("Rating","atrating")."</th> 36 <th>".MakeLink("Her vyhráno","atwin")."</th> 37 <th>".MakeLink("Her hráno","atgames")."</th> 38 </tr> 39 "; 40 $query = $db -> 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.";"); 41 while ($row = $query -> fetch_array()) 42 { 43 echo " 44 <tr> 45 <td align=\"center\">".$row["atname"]."</td> 46 <td align=\"center\">".$row["l_name"]."</td> 47 <td align=\"center\">".$row["attype"]."</td> 48 <td align=\"center\">".$row["tot_chars"]."</td> 49 <td align=\"center\">".$row["atrating"]."</td> 50 <td align=\"center\">".$row["atwins"]."</td> 51 <td align=\"center\">".$row["atgames"]."</td> 52 </tr> 53 "; 54 } 55 echo "</table></center>"; 30 <th>'.MakeLink('Typ', 'attype').'</th> 31 <th>'.MakeLink('Členů', 'tot_chars').'</th> 32 <th>'.MakeLink('Rating', 'atrating').'</th> 33 <th>'.MakeLink('Her vyhráno', 'atwin').'</th> 34 <th>'.MakeLink('Her hráno', 'atgames').'</th> 35 </tr>'); 36 $query = $db->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); 37 while($row = $query->fetch_assoc()) 38 { 39 echo('<tr> 40 <td align="center">'.$row['atname'].'</td> 41 <td align="center">'.$row['l_name'].'</td> 42 <td align="center">'.$row['attype'].'</td> 43 <td align="center">'.$row['tot_chars'].'</td> 44 <td align="center">'.$row['atrating'].'</td> 45 <td align="center">'.$row['atwins'].'</td> 46 <td align="center">'.$row['atgames'].'</td> 47 </tr>'); 48 } 49 echo('</table></center>'); 50 56 51 ?>
Note:
See TracChangeset
for help on using the changeset viewer.