| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | $Columns = array('name', 'atname', 'attype', 'tot_chars', 'atrating', 'atwins', 'atgames');
|
|---|
| 4 | $order_by = (isset($_GET['order'])) ? $_GET['order'] : 'atname';
|
|---|
| 5 | if(!in_array($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)
|
|---|
| 12 | {
|
|---|
| 13 | global $dir, $dir_img, $html;
|
|---|
| 14 |
|
|---|
| 15 | if(isset($_GET['order']) and $_GET['order'] == $sort) $arrow = $dir_img;
|
|---|
| 16 | else $arrow = '';
|
|---|
| 17 | return($arrow.'<a href="'.$html->Link('/arena/?order='.$sort.'&dir='.$dir).'">'.$show.'</a>');
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | $Realm = new Realm($System, $_COOKIE['RealmIndex']);
|
|---|
| 21 | $db = $Realm->CharactersDatabase;
|
|---|
| 22 |
|
|---|
| 23 | $count = $db->query('SELECT COUNT(*) FROM arena_team')->fetch_row();
|
|---|
| 24 | $all_record = $count[0];
|
|---|
| 25 | echo('<h3 class="PageTitle">Arénové týmy :</h3>');
|
|---|
| 26 | echo('Celkem týmů : <strong>'.$all_record.'</strong>
|
|---|
| 27 | <table class="BaseTable">
|
|---|
| 28 | <tr>
|
|---|
| 29 | <th>'.MakeLink('Tým', 'atname').'</th>
|
|---|
| 30 | <th>Kapitán</th>
|
|---|
| 31 | <th>'.MakeLink('Typ', 'attype').'</th>
|
|---|
| 32 | <th>'.MakeLink('Členů', 'tot_chars').'</th>
|
|---|
| 33 | <th>'.MakeLink('Rating', 'atrating').'</th>
|
|---|
| 34 | <th>'.MakeLink('Her vyhráno', 'atwins').'</th>
|
|---|
| 35 | <th>'.MakeLink('Her hráno', 'atgames').'</th>
|
|---|
| 36 | </tr>');
|
|---|
| 37 | $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);
|
|---|
| 38 | while($row = $query->fetch_assoc())
|
|---|
| 39 | {
|
|---|
| 40 | echo('<tr>
|
|---|
| 41 | <td align="center">'.$row['atname'].'</td>
|
|---|
| 42 | <td align="center">'.$row['l_name'].'</td>
|
|---|
| 43 | <td align="center">'.$row['attype'].'</td>
|
|---|
| 44 | <td align="center">'.$row['tot_chars'].'</td>
|
|---|
| 45 | <td align="center">'.$row['atrating'].'</td>
|
|---|
| 46 | <td align="center">'.$row['atwins'].'</td>
|
|---|
| 47 | <td align="center">'.$row['atgames'].'</td>
|
|---|
| 48 | </tr>');
|
|---|
| 49 | }
|
|---|
| 50 | echo('</table>');
|
|---|
| 51 |
|
|---|
| 52 | ?>
|
|---|