1
<?php
2
/**
3
 *   File functions:
4
 *   Show Best Players in Game
5
 */
6
7
$title = 'Ranking Graczy';
8
require_once('includes/head.php');
9
10
/**
11
* Get the localization for game
12
*/
13
require('languages/'.$player -> lang.'/ranking.php');
14
15
if ($player -> location != 'Altara' && $player -> location != 'Ardulith')
16
{
17
    error (ERROR);
18
}
19
20
$smarty -> cache_dir = 'cache/';
21
$smarty -> caching = 2;
22
$smarty -> cache_lifetime = 3600;   // Ranking will be refreshed after 1 hour from first viewing.
23
24
if (!$smarty -> is_cached('ranking.tpl'))
25
{
26
    $oldFetchMode = $db -> SetFetchMode(ADODB_FETCH_NUM);
27
/// TODO: Po wywaleniu pola z bazy danych warto zmienić to "r" w zapytaniu na "ranking". W *.tpl-ce zmieniłem komórki tabeli <td> nagłówkowe na <th> i wyciepałem większość stylowania. Aranwe tam miał ze Sleszem coś fajnego dla tabel przygotować. Wiem, że chudo wygląda, ale może to puści na 2 kolumny albo coś... Widzę że muszę jakiś tutorialowy artykuł przygotować z GetAll i FETCH_NUM, bo z użyciem cieńko :)
28
    $arrStats = $db -> GetAll('SELECT `id`, `user`, `level`, (`agility` + `strength` + `inteli` + `wisdom` + `szyb` + `wytrz` + `alchemia`)/20 + (`mining` + `lumberjack`)/10 + (`jeweller` + `fletcher` + `ability` + `herbalist` + `unik` + `magia` + `shoot` + `atak`)/5 + (`level` + `breeding`) * 2  + `leadership` AS `r` FROM `players` ORDER BY `r` DESC LIMIT 50');
29
30
    $smarty -> assign_by_ref('arrStats', $arrStats);
31
    $db -> SetFetchMode($oldFetchMode);
32
    $smarty -> display('ranking.tpl');
33
    unset($arrStats);
34
}
35
else
36
{
37
    $smarty -> display('ranking.tpl');
38
}
39
40
$smarty -> caching = 0;
41
require_once('includes/foot.php');
42
?>