root/dev/common/standings.php @ 195

Revision 190, 2.1 KB (checked in by exi, 15 years ago)

This is a big update...
Moved all admin scripts to common/admin.
Moved all includes and classes to common/includes.
Edited all include-paths to reflect the movement.
Fixed a bug with the session system allowing every registered user to access admin pages.
Replaced calls to date() to use a wrapper so gmdate can be used.
Replaced some calls to $config with calls to the static object.
Fixed a big which caused the portrait_grab to not download a new picute.
Added a classified-state to kills.
Removed the sync_server server script in this tree.
Added code to help modules find the includes to index.php.

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