root/dev/common/kills.php @ 459

Revision 459, 3.1 KB (checked in by kovell, 13 years ago)

Fixes: headers for uncached page set correctly, summary additions evaluated with isset instead of intval, ctr_id and scl_id explicitly set as int. unused pages removed.

Line 
1<?php
2// Kills page. Display a list of most recent kills and the top killers for
3// the week
4require_once('common/includes/class.corp.php');
5require_once('common/includes/class.alliance.php');
6require_once('common/includes/class.killlist.php');
7require_once('common/includes/class.ship.php');
8require_once('common/includes/class.killlisttable.php');
9require_once('common/includes/class.killsummarytable.public.php');
10require_once('common/includes/class.toplist.php');
11
12$week = intval($_GET['w']);
13$year = intval($_GET['y']);
14
15if ($week == '')
16    $week = kbdate('W');
17
18if ($year == '')
19    $year = getYear();
20
21if ($week == 53)
22{
23    $nweek = 1;
24    $nyear = $year + 1;
25    $pyear = $year - 1;
26}
27else
28{
29    $nweek = $week + 1;
30    $nyear = $year;
31}
32if ($week == 1)
33{
34    $pweek = 53;
35    $pyear = $year - 1;
36}
37else
38{
39    $pweek = $week - 1;
40    $pyear = $year;
41}
42
43$page = new Page("Kills - Week ".$week);
44
45// Build summary table
46$kslist = new KillList();
47$kslist->setWeek($week);
48$kslist->setYear($year);
49involved::load($kslist,'kill');
50
51if (config::get('summarytable')){
52if (config::get('public_summarytable')){
53        $summarytable = new KillSummaryTablePublic($kslist);
54}
55else
56{
57        $llist = new KillList();
58        $llist->setWeek($week);
59        $llist->setYear($year);
60        involved::load($llist,'loss');
61        $summarytable = new KillSummaryTable($kslist, $llist);
62}
63$summarytable->setBreak(config::get('summarytable_rowcount'));
64$html .= $summarytable->generate();
65}
66
67// Build table of recent kills
68$klist = new KillList();
69$klist->setOrdered(true);
70if (config::get('comments_count')) $klist->setCountComments(true);
71if (config::get('killlist_involved')) $klist->setCountInvolved(true);
72$klist->setWeek($week);
73$klist->setYear($year);
74involved::load($klist,'kill');
75if ($_GET['scl_id'])
76    $klist->addVictimShipClass(intval($_GET['scl_id']));
77else
78    $klist->setPodsNoobShips(false);
79
80$pagesplitter = new PageSplitter($klist->getCount(), 30);
81$klist->setPageSplitter($pagesplitter);
82$table = new KillListTable($klist);
83$html .= $table->generate();
84$html .= $pagesplitter->generate();
85
86$page->setContent($html);
87
88// Create side menu
89$menubox = new box("Menu");
90$menubox->setIcon("menu-item.gif");
91$menubox->addOption("caption", "Navigation");
92$menubox->addOption("link", "Previous week ", "?a=kills&w=".$pweek."&y=".$pyear);
93if ($week != kbdate("W"))
94{
95    $menubox->addOption('link', "Next week", "?a=kills&w=".$nweek."&y=".$nyear);
96}
97$page->addContext($menubox->generate());
98
99// Create top kills list
100$tklist = new TopKillsList();
101$tklist->setWeek($week);
102$tklist->setYear($year);
103involved::load($tklist,'kill');
104
105$tklist->generate();
106$tkbox = new AwardBox($tklist, "Top killers", "kills in week ".$week, "kills", "eagle");
107$page->addContext($tkbox->generate());
108
109// If 'kill_points' is set, create top scores list
110if (config::get('kill_points'))
111{
112    $tklist = new TopScoreList();
113    $tklist->setWeek($week);
114    $tklist->setYear($year);
115    involved::load($tklist,'kill');
116
117    $tklist->generate();
118    $tkbox = new AwardBox($tklist, "Top scorers", "points in week ".$week, "points", "redcross");
119    $page->addContext($tkbox->generate());
120}
121
122$page->generate();
123?>
Note: See TracBrowser for help on using the browser.