root/dev/mods/example_mod/home.php @ 240

Revision 240, 3.2 KB (checked in by ralle030583, 14 years ago)

Implemented exi's involvedloader class

Line 
1<?php
2require_once('common/includes/class.killsummarytable.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.contract.php');
8require_once('common/includes/class.toplist.php');
9
10$week = kbdate('W');
11$year = kbdate('Y');
12
13$page = new Page("omgwtfpwnd!!!1");
14
15$kslist = new KillList();
16involved::load($kslist,'kill');
17$kslist->setWeek($week);
18$kslist->setYear($year);
19
20$llist = new KillList();
21involved::load($llist,'loss');
22$llist->setWeek($week);
23$llist->setYear($year);
24
25$summarytable = new KillSummaryTable($kslist, $llist);
26$summarytable->setBreak(5);
27$html .= $summarytable->generate();
28
29if ($week == 1)
30{
31    $pyear = kbdate("Y") - 1;
32    $pweek = 52;
33}
34else
35{
36    $pyear = kbdate("Y");
37    $pweek = $week - 1;
38}
39
40if ($page->killboard_->hasCampaigns(true))
41{
42    $html .= "<div class=kb-campaigns-header>Active campaigns</div>";
43    $list = new ContractList();
44    $list->setActive("yes");
45    $list->setCampaigns(true);
46    $table = new ContractListTable($list);
47    $html .= $table->generate();
48}
49
50if ($page->killboard_->hasContracts(true))
51{
52    $html .= "<div class=kb-campaigns-header>Active contracts</div>";
53    $list = new ContractList();
54    $list->setActive("yes");
55    $list->setCampaigns(false);
56    $table = new ContractListTable($list);
57    $html .= $table->generate();
58}
59
60// bad hax0ring, we really need mod callback stuff
61if (strpos(config::get('mods_active'), 'rss_feed') !== false)
62{
63    $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>";
64}
65else
66{
67    $html .= "<div class=kb-kills-header>20 most recent kills</div>";
68}
69
70$klist = new KillList();
71$klist->setOrdered(true);
72involved::load($klist,'kill');
73
74
75// boards with low killcount could not display 20 kills with those limits
76//$klist->setStartWeek($week - 1);
77//$klist->setYear($year);
78$klist->setLimit(20);
79
80if ($_GET['scl_id'])
81    $klist->addVictimShipClass(new ShipClass($_GET['scl_id']));
82else
83    $klist->setPodsNoobShips(false);
84
85$table = new KillListTable($klist);
86$table->setLimit(20);
87$html .= $table->generate();
88
89$page->setContent($html);
90$menubox = new box("Menu");
91$menubox->setIcon("menu-item.gif");
92$menubox->addOption("caption","Navigation");
93$menubox->addOption("link","Previous week", "?a=kills&w=" . $pweek . "&y=" . $pyear);
94$page->addContext($menubox->generate());
95
96$tklist = new TopKillsList();
97$tklist->setWeek($week);
98$tklist->setYear($year);
99involved::load($tklist,'kill');
100
101$tklist->generate();
102$tkbox = new AwardBox($tklist, "Top killers", "kills in week " . $week, "kills", "eagle");
103$page->addContext($tkbox->generate());
104
105if (config::get('kill_points'))
106{
107    $tklist = new TopScoreList();
108    $tklist->setWeek($week);
109    $tklist->setYear($year);
110    involved::load($tklist,'kill');
111
112    $tklist->generate();
113    $tkbox = new AwardBox($tklist, "Top scorers", "points in week " . $week, "points", "redcross");
114    $page->addContext($tkbox->generate());
115}
116
117$page->generate();
118?>
Note: See TracBrowser for help on using the browser.