root/dev/common/losses.php @ 195

Revision 190, 2.9 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.killlisttable.php');
7require_once('common/includes/class.killsummarytable.php');
8require_once('common/includes/class.toplist.php');
9
10$week = $_GET['w'];
11$year = $_GET['y'];
12
13if ($week == '')
14    $week = kbdate('W');
15
16if ($year == '')
17    $year = kbdate('Y');
18
19if ($week == 52)
20{
21    $nweek = 1;
22    $nyear = $year + 1;
23}
24else
25{
26    $nweek = $week + 1;
27    $nyear = $year;
28}
29if ($week == "1")
30{
31    $pweek = 52;
32    $pyear = $year - 1;
33}
34else
35{
36    $pweek = $week - 1;
37    $pyear = $year;
38}
39
40$page = new Page("Losses - Week ".$week);
41
42$klist = new KillList();
43$klist->setWeek($week);
44$klist->setYear($year);
45if (CORP_ID)
46    $klist->addInvolvedCorp(new Corporation(CORP_ID));
47if (ALLIANCE_ID)
48    $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
49
50$lslist = new KillList();
51$lslist->setWeek($week);
52$lslist->setYear($year);
53if (CORP_ID)
54    $lslist->addVictimCorp(new Corporation(CORP_ID));
55if (ALLIANCE_ID)
56    $lslist->addVictimAlliance(new Alliance(ALLIANCE_ID));
57
58$summarytable = new KillSummaryTable($klist, $lslist);
59$summarytable->setBreak(6);
60$html .= $summarytable->generate();
61// $html .= "<table width=\"99%\" align=center><tr><td class=weeknav align=left>";
62// if ( $week != kbdate( "W" ) )
63// $html .= "[<a href=\"?a=losses&w=".$nweek."&y=".$nyear."\"><<</a>]";
64// $html .= "</td><td class=weeknav align=right>[<a href=\"?a=losses&w=".$pweek."&y=".$pyear."\">>></a>]</td></tr></table>";
65$llist = new KillList();
66$llist->setOrdered(true);
67$llist->setWeek($week);
68$llist->setYear($year);
69if (CORP_ID)
70    $llist->addVictimCorp(new Corporation(CORP_ID));
71if (ALLIANCE_ID)
72    $llist->addVictimAlliance(new Alliance(ALLIANCE_ID));
73if ($_GET['scl_id'])
74    $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
75else
76    $llist->setPodsNoobShips(false);
77
78$table = new KillListTable($llist);
79$html .= $table->generate();
80
81$menubox = new box("Menu");
82$menubox->setIcon("menu-item.gif");
83$menubox->addOption("caption", "Navigation");
84$menubox->addOption("link", "Previous week", "?a=losses&w=".$pweek."&y=".$pyear);
85if ($week != kbdate("W"))
86{
87    $menubox->addOption("link", "Next week", "?a=losses&w=".$nweek."&y=".$nyear);
88}
89$page->addContext($menubox->generate());
90
91$tllist = new TopLossesList();
92$tllist->setWeek($week);
93$tllist->setYear($year);
94if (CORP_ID)
95    $tllist->addVictimCorp(new Corporation(CORP_ID));
96if (ALLIANCE_ID)
97    $tllist->addVictimAlliance(new Alliance(ALLIANCE_ID));
98
99$tllist->generate();
100$tlbox = new AwardBox($tllist, "Top losers", "losses in week ".$week, "losses", "moon");
101$page->addContext($tlbox->generate());
102
103$page->setContent($html);
104$page->generate();
105?>
Note: See TracBrowser for help on using the browser.