root/dev/common/home.php @ 135

Revision 135, 3.8 KB (checked in by exi, 14 years ago)

Added an rss-icon to main page.
Cleaned up kill_detail template.
Added autoupgrade code for standings table.

Line 
1<?php
2require_once("class.page.php");
3require_once("class.killsummarytable.php");
4require_once("class.box.php");
5require_once("class.corp.php");
6require_once("class.alliance.php");
7require_once("class.killlist.php");
8require_once("class.killlisttable.php");
9require_once("class.contract.php");
10require_once("class.graph.php");
11require_once("class.toplist.php");
12
13$week = date("W");
14$year = date("Y");
15
16$page = new Page("Week " . $week);
17
18$kslist = new KillList();
19if (CORP_ID)
20    $kslist->addInvolvedCorp(new Corporation(CORP_ID));
21if (ALLIANCE_ID)
22    $kslist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
23
24$kslist->setWeek($week);
25$kslist->setYear($year);
26
27$llist = new KillList();
28if (CORP_ID)
29    $llist->addVictimCorp(new Corporation(CORP_ID));
30if (ALLIANCE_ID)
31    $llist->addVictimAlliance(new Alliance(ALLIANCE_ID));
32
33$llist->setWeek($week);
34$llist->setYear($year);
35
36$summarytable = new KillSummaryTable($kslist, $llist);
37$summarytable->setBreak(6);
38$html .= $summarytable->generate();
39
40if ($week == 1)
41{
42    $pyear = date("Y") - 1;
43    $pweek = 52;
44}
45else
46{
47    $pyear = date("Y");
48    $pweek = $week - 1;
49}
50
51if ($page->killboard_->hasCampaigns(true))
52{
53    $html .= "<div class=kb-campaigns-header>Active campaigns</div>";
54    $list = new ContractList();
55    $list->setActive("yes");
56    $list->setCampaigns(true);
57    $table = new ContractListTable($list);
58    $html .= $table->generate();
59}
60
61if ($page->killboard_->hasContracts(true))
62{
63    $html .= "<div class=kb-campaigns-header>Active contracts</div>";
64    $list = new ContractList();
65    $list->setActive("yes");
66    $list->setCampaigns(false);
67    $table = new ContractListTable($list);
68    $html .= $table->generate();
69}
70
71// bad hax0ring, we really need mod callback stuff
72if (strpos($config->getConfig('mods_active'), 'rss_feed') !== false)
73{
74    $html .= "<div class=kb-kills-header><a href=\"?a=rss\"><img src=\"mods/rss_feed/rss_icon.png\" alt=\"RSS-Feed\" border=\"0\"></a>&nbsp;20 most recent kills</div>";
75}
76else
77{
78    $html .= "<div class=kb-kills-header>20 most recent kills</div>";
79}
80
81$klist = new KillList();
82$klist->setOrdered(true);
83if (CORP_ID)
84    $klist->addInvolvedCorp(new Corporation(CORP_ID));
85if (ALLIANCE_ID)
86    $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
87
88// boards with low killcount could not display 20 kills with those limits
89//$klist->setStartWeek($week - 1);
90//$klist->setYear($year);
91$klist->setLimit(20);
92
93if ($_GET['scl_id'])
94    $klist->addVictimShipClass(new ShipClass($_GET['scl_id']));
95else
96    $klist->setPodsNoobShips(false);
97
98$table = new KillListTable($klist);
99$table->setLimit(20);
100$html .= $table->generate();
101
102$page->setContent($html);
103$menubox = new box("Menu");
104$menubox->setIcon("menu-item.gif");
105$menubox->addOption("caption","Navigation");
106$menubox->addOption("link","Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear);
107$page->addContext($menubox->generate());
108
109$tklist = new TopKillsList();
110$tklist->setWeek($week);
111$tklist->setYear($year);
112if (CORP_ID)
113    $tklist->addInvolvedCorp(new Corporation(CORP_ID));
114if (ALLIANCE_ID)
115    $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
116
117$tklist->generate();
118$tkbox = new AwardBox($tklist, "Top killers", "kills in week " . $week, "kills", "eagle");
119$page->addContext($tkbox->generate());
120
121if ($config->getKillPoints())
122{
123    $tklist = new TopScoreList();
124    $tklist->setWeek($week);
125    $tklist->setYear($year);
126    if (CORP_ID)
127        $tklist->addInvolvedCorp(new Corporation(CORP_ID));
128    if (ALLIANCE_ID)
129        $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
130
131    $tklist->generate();
132    $tkbox = new AwardBox($tklist, "Top scorers", "points in week " . $week, "points", "redcross");
133    $page->addContext($tkbox->generate());
134}
135
136$page->generate();
137?>
Note: See TracBrowser for help on using the browser.