root/dev/common/home.php @ 104

Revision 104, 3.5 KB (checked in by knifee, 14 years ago)

Changed the class.box.php to use smarty, and changed all pages that use the class to use the options. Menu Boxes can now be created as follows:
$menubox = new box("Menu");
$menubox->setIcon("menu-item.gif"); // only needed if adding a Menu (ie u want the little icon)
$menubox->addOption("caption","View"); // Add a Caption
$menubox->addOption("link","Name","URL"); // Add a Link
$menubox->addOption("points","Points Value"); // Add points to a Points Box
$menubox->addOption("img","/path to img"); // Add an Image

changed the AwardBox? Class to use smarty, that is called in the same way as before so no need to change anything.

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$html .= "<div class=kb-kills-header>20 most recent kills</div>";
72
73$klist = new KillList();
74$klist->setOrdered(true);
75if (CORP_ID)
76    $klist->addInvolvedCorp(new Corporation(CORP_ID));
77if (ALLIANCE_ID)
78    $klist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
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);
104if (CORP_ID)
105    $tklist->addInvolvedCorp(new Corporation(CORP_ID));
106if (ALLIANCE_ID)
107    $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
108
109$tklist->generate();
110$tkbox = new AwardBox($tklist, "Top killers", "kills in week " . $week, "kills", "eagle");
111$page->addContext($tkbox->generate());
112
113if ($config->getKillPoints())
114{
115    $tklist = new TopScoreList();
116    $tklist->setWeek($week);
117    $tklist->setYear($year);
118    if (CORP_ID)
119        $tklist->addInvolvedCorp(new Corporation(CORP_ID));
120    if (ALLIANCE_ID)
121        $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
122
123    $tklist->generate();
124    $tkbox = new AwardBox($tklist, "Top scorers", "points in week " . $week, "points", "redcross");
125    $page->addContext($tkbox->generate());
126}
127
128$page->generate();
129?>
Note: See TracBrowser for help on using the browser.