1 | <?php |
---|
2 | require_once('common/includes/class.corp.php'); |
---|
3 | require_once('common/includes/class.alliance.php'); |
---|
4 | |
---|
5 | $page = new Page(); |
---|
6 | $page->setTitle('Standings'); |
---|
7 | |
---|
8 | $qry = new DBQuery(); |
---|
9 | if (CORP_ID) |
---|
10 | { |
---|
11 | $qry->execute('SELECT * FROM kb3_standings WHERE sta_from='.CORP_ID.' AND sta_from_type=\'c\' ORDER BY sta_value DESC'); |
---|
12 | } |
---|
13 | else |
---|
14 | { |
---|
15 | $qry->execute('SELECT * FROM kb3_standings WHERE sta_from='.ALLIANCE_ID.' AND sta_from_type=\'a\' ORDER BY sta_value DESC'); |
---|
16 | } |
---|
17 | |
---|
18 | $permt = array(); |
---|
19 | while ($row = $qry->getRow()) |
---|
20 | { |
---|
21 | $typ = $row['sta_to_type']; |
---|
22 | $val = sprintf("%01.1f", $row['sta_value']); |
---|
23 | $id = $row['sta_to']; |
---|
24 | |
---|
25 | if ($row['sta_value'] > 5) |
---|
26 | { |
---|
27 | $icon = 'high'; |
---|
28 | } |
---|
29 | elseif ($row['sta_value'] > 0) |
---|
30 | { |
---|
31 | $icon = 'good'; |
---|
32 | } |
---|
33 | elseif ($row['sta_value'] > -5) |
---|
34 | { |
---|
35 | $icon = 'bad'; |
---|
36 | } |
---|
37 | else |
---|
38 | { |
---|
39 | $icon = 'horrible'; |
---|
40 | } |
---|
41 | |
---|
42 | if ($typ == 'a') |
---|
43 | { |
---|
44 | $alliance = new Alliance($row['sta_to']); |
---|
45 | $text = $alliance->getName(); |
---|
46 | $pid = $alliance->getUnique(); |
---|
47 | $link = '?a=admin_standings&del='.$typ.$row['sta_to']; |
---|
48 | $permt[$typ][] = array('text' => $text, 'link' => $link, 'value' => $val, 'comment' => $row['sta_comment'], |
---|
49 | 'id' => $id, 'pid' => $pid, 'typ' => $row['sta_to'], 'icon' => $icon); |
---|
50 | } |
---|
51 | if ($typ == 'c') |
---|
52 | { |
---|
53 | $corp = new Corporation($row['sta_to']); |
---|
54 | $text = $corp->getName(); |
---|
55 | $link = '?a=admin_standings&del='.$typ.$row['sta_to']; |
---|
56 | $permt[$typ][] = array('text' => $text, 'link' => $link, 'value' => $val, 'comment' => $row['sta_comment'], |
---|
57 | 'id' => $id, 'typ' => $typ, 'icon' => $icon); |
---|
58 | } |
---|
59 | } |
---|
60 | $perm = array(); |
---|
61 | if ($permt['a']) |
---|
62 | { |
---|
63 | $perm[] = array('name' => 'Alliances', 'list' => $permt['a']); |
---|
64 | } |
---|
65 | if ($permt['c']) |
---|
66 | { |
---|
67 | $perm[] = array('name' => 'Corporations', 'list' => $permt['c']); |
---|
68 | } |
---|
69 | |
---|
70 | $smarty->assign_by_ref('standings', $perm); |
---|
71 | |
---|
72 | $page->setContent($smarty->fetch(get_tpl('standings'))); |
---|
73 | $page->generate(); |
---|
74 | ?> |
---|