source: pages/wss_partners.php

Last change on this file was 12, checked in by george, 15 years ago
  • Opraveno: Počet serverů na stránku dle konfigurace.
File size: 3.5 KB
Line 
1<?php
2$tpl->output['th_players'] = $text['th_players'];
3$tpl->output['th_name'] = $text['name'];
4$tpl->output['th_latency'] = $text['th_latency'];
5$tpl->output['th_version'] = $text['th_version'];
6$tpl->output['th_xp'] = $text['th_xp'];
7$tpl->output['th_online_state'] = $text['th_online_state'];
8$tpl->output['th_type'] = $text['th_type'];
9$tpl->output['th_rating'] = $text['th_rating'];
10$tpl->output['th_recommend'] = $text['th_recommend'];
11$tpl->output['th_created'] = $text['th_created'];
12$tpl->output['order_by'] = $text['order_by'];
13$tpl->output['place'] = $text['info_place'];
14$tpl->output['wss_partners_h2'] = $menu['mm2'];
15
16if(!array_key_exists('order', $_GET)) $_GET['order'] = 0;
17$order_index = (int) $_GET['order'];
18switch ($order_index)
19 {
20 case 0: $order = ' order by `name`'; break;
21 case 1: $order = ' order by `rating` desc '; break;
22 case 2: $order = ' order by `version` desc '; break;
23 case 3: $order = ' order by `type` desc '; break;
24 case 4: $order = ' order by `xp` desc '; break;
25 case 5: $order = ' order by `players` desc '; break;
26 case 6: $order = ' order by `online` desc '; break;
27 case 7: $order = ' order by ceil(`online` / 100) desc, `latency`'; break;
28 case 8: $order = ' order by `created` desc'; break;
29 }
30$tpl->output['s0'] = '';
31$tpl->output['s1'] = '';
32$tpl->output['s2'] = '';
33$tpl->output['s3'] = '';
34$tpl->output['s4'] = '';
35$tpl->output['s5'] = '';
36$tpl->output['s6'] = '';
37$tpl->output['s7'] = '';
38$tpl->output['s8'] = '';
39if (empty($order_index))
40 {
41 $tpl->output['s0'] = 'SELECTED';
42 }
43else
44 {
45 $tpl->output['s'.$order_index] = 'SELECTED';
46 }
47
48$pa = new CleverPager('select `id`,`wss_partner`, LEFT(`name`, 25) as `name`, `place`, `rating_sum`/`ratings` as `rating`, `version`, `type`, `xp`, `online`, `online_players_sum`/`player_checks` as `players`,`latency` from `servers` where `wss_partner`=1 '.$order, 'p');
49$pa->PageSize = $Config['DisplayServerCountPerPage'];
50$pa->PageLinksDisplayed = 5;
51$pa->CountCommand = 'select count(*) as Count from `servers` where `wss_partner` =1';
52$pa->DataBind();
53$tpl->output['servers_data'] = '';
54while ($row = $pa->GetOne())
55 {
56 switch ($row['xp'])
57 {
58 case 1: $xp = 'Very low'; break;
59 case 2: $xp = 'Low'; break;
60 case 3: $xp = 'Normal'; break;
61 case 4: $xp = 'High'; break;
62 case 5: $xp = 'Very high'; break;
63 }
64 if ($row['place']==1)
65 {
66 $place = $text['reg_czech'];
67 }
68 else
69 {
70 $place = $text['reg_abroad'];
71 }
72 $tpl->output['servers_data'] .= '<tr>';
73 $tpl->output['servers_data'] .= ($row['wss_partner']==1)?'<td><img src="templates/img/hvezda.gif" alt="Doporučujeme" title="Doporučujeme"></td>':'<td></td>';
74 $tpl->output['servers_data'] .='<td align="left">'.ulink('server/'.$row['id'], $row['name']).'</td>';
75 $tpl->output['servers_data'] .='<td>'.round($row['rating'],2).'</td>';
76 $tpl->output['servers_data'] .='<td>'.$row['version'].'</td>';
77 $tpl->output['servers_data'] .='<td>'.$row['type'].'</td>';
78 $tpl->output['servers_data'] .='<td>'.$xp.'</td>';
79 $tpl->output['servers_data'] .='<td>'.(int)$row['players'].'</td>';
80 $tpl->output['servers_data'] .='<td>'.$row['online'].'%</td>';
81 if($row['latency'] == 0) $Latency = '?'; else $Latency = round($row['latency']).'ms';
82 $tpl->output['servers_data'] .='<td>'.$Latency.'</td>';
83 $tpl->output['servers_data'] .='</tr>';
84 }
85ob_start();
86$pa->DrawPager();
87$tpl->output['pager'] = ob_get_contents();
88ob_clean();
89?>
Note: See TracBrowser for help on using the repository browser.