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

Revision 281, 3.4 KB (checked in by ralle030583, 13 years ago)

- redesign of public mode, so only choosen summarytables are changed not all
- rowcount summarytables increased setBreak(5)-> setBreak(6)

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