root/dev/common/kills.php @ 195

Revision 190, 3.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');
5require_once('common/includes/class.killlist.php');
6require_once('common/includes/class.ship.php');
7require_once('common/includes/class.killlisttable.php');
8require_once('common/includes/class.killsummarytable.php');
9require_once('common/includes/class.toplist.php');
10
11$week = $_GET['w'];
12$year = $_GET['y'];
13
14if ($week == '')
15    $week = kbdate('W');
16
17if ($year == '')
18    $year = kbdate('Y');
19
20if ($week == 52)
21{
22    $nweek = 1;
23    $nyear = $year + 1;
24    $pyear = $year - 1;
25}
26else
27{
28    $nweek = $week + 1;
29    $nyear = $year;
30}
31if ($week == 1)
32{
33    $pweek = 52;
34    $pyear = $year - 1;
35}
36else
37{
38    $pweek = $week - 1;
39    $pyear = $year;
40}
41
42$page = new Page("Kills - Week ".$week);
43
44$kslist = new KillList();
45$kslist->setWeek($week);
46$kslist->setYear($year);
47if (CORP_ID)
48    $kslist->addInvolvedCorp(new Corporation(CORP_ID));
49if (ALLIANCE_ID)
50    $kslist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
51
52$llist = new KillList();
53$llist->setWeek($week);
54$llist->setYear($year);
55if (CORP_ID)
56    $llist->addVictimCorp(new Corporation(CORP_ID));
57if (ALLIANCE_ID)
58    $llist->addVictimAlliance(new Alliance(ALLIANCE_ID));
59
60$summarytable = new KillSummaryTable($kslist, $llist);
61$summarytable->setBreak(6);
62$html .= $summarytable->generate();
63
64$klist = new KillList();
65$klist->setOrdered(true);
66$klist->setWeek($week);
67$klist->setYear($year);
68if (CORP_ID)
69    $klist->addInvolvedCorp(new Corporation(CORP_ID));
70if (ALLIANCE_ID)
71    $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
72if ($_GET['scl_id'])
73    $klist->addVictimShipClass(new ShipClass($_GET['scl_id']));
74else
75    $klist->setPodsNoobShips(false);
76
77$table = new KillListTable($klist);
78$html .= $table->generate();
79
80$page->setContent($html);
81$menubox = new box("Menu");
82$menubox->setIcon("menu-item.gif");
83$menubox->addOption("caption", "Navigation");
84$menubox->addOption("link", "Previous week ", "?a=kills&w=".$pweek."&y=".$pyear);
85if ($week != kbdate("W"))
86{
87    $menubox->addOption('link', "Next week", "?a=kills&w=".$nweek."&y=".$nyear);
88}
89$page->addContext($menubox->generate());
90
91$tklist = new TopKillsList();
92$tklist->setWeek($week);
93$tklist->setYear($year);
94if (CORP_ID)
95    $tklist->addInvolvedCorp(new Corporation(CORP_ID));
96if (ALLIANCE_ID)
97    $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
98
99$tklist->generate();
100$tkbox = new AwardBox($tklist, "Top killers", "kills in week ".$week, "kills", "eagle");
101$page->addContext($tkbox->generate());
102
103if (config::get('kill_points'))
104{
105    $tklist = new TopScoreList();
106    $tklist->setWeek($week);
107    $tklist->setYear($year);
108    if (CORP_ID)
109        $tklist->addInvolvedCorp(new Corporation(CORP_ID));
110    if (ALLIANCE_ID)
111        $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
112
113    $tklist->generate();
114    $tkbox = new AwardBox($tklist, "Top scorers", "points in week ".$week, "points", "redcross");
115    $page->addContext($tkbox->generate());
116}
117
118$page->generate();
119?>
Note: See TracBrowser for help on using the browser.