root/dev/common/losses.php @ 368

Revision 368, 2.6 KB (checked in by exi, 14 years ago)

Fixed the pre PHP 5.1.0 issue with the current year, it will run on php4 again but stil has the week 52/1 issue (kindof).
Removed debug content from globals.php.

Line 
1<?php
2require_once('common/includes/class.corp.php');
3require_once('common/includes/class.alliance.php');
4require_once('common/includes/class.killlist.php');
5require_once('common/includes/class.killlisttable.php');
6require_once('common/includes/class.killsummarytable.php');
7require_once('common/includes/class.toplist.php');
8
9if (config::get('public_losses')){
10        die('Forbidden');
11}
12
13$week = $_GET['w'];
14$year = $_GET['y'];
15
16if ($week == '')
17    $week = kbdate('W');
18
19if ($year == '')
20    $year = getYear();
21
22if ($week == 52)
23{
24    $nweek = 1;
25    $nyear = $year + 1;
26}
27else
28{
29    $nweek = $week + 1;
30    $nyear = $year;
31}
32if ($week == "1")
33{
34    $pweek = 52;
35    $pyear = $year - 1;
36}
37else
38{
39    $pweek = $week - 1;
40    $pyear = $year;
41}
42
43$page = new Page("Losses - Week ".$week);
44
45$klist = new KillList();
46$klist->setWeek($week);
47$klist->setYear($year);
48involved::load($klist,'kill');
49
50$lslist = new KillList();
51$lslist->setWeek($week);
52$lslist->setYear($year);
53involved::load($lslist,'loss');
54
55if (config::get('summarytable')){
56$summarytable = new KillSummaryTable($klist, $lslist);
57$summarytable->setBreak(config::get('summarytable_rowcount'));
58$html .= $summarytable->generate();
59}
60
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);
69involved::load($llist,'loss');
70if ($_GET['scl_id'])
71    $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
72else
73    $llist->setPodsNoobShips(false);
74
75$pagesplitter = new PageSplitter($llist->getCount(), 30);
76$llist->setPageSplitter($pagesplitter);
77$table = new KillListTable($llist);
78$html .= $table->generate();
79$html .= $pagesplitter->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);
94involved::load($tllist,'loss');
95
96$tllist->generate();
97$tlbox = new AwardBox($tllist, "Top losers", "losses in week ".$week, "losses", "moon");
98$page->addContext($tlbox->generate());
99
100$page->setContent($html);
101$page->generate();
102?>
Note: See TracBrowser for help on using the browser.