root/dev/common/pilot_detail.php @ 104

Revision 104, 6.7 KB (checked in by knifee, 16 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.pilot.php");
4require_once("class.corp.php");
5require_once("class.alliance.php");
6require_once("class.kill.php");
7require_once("class.killlist.php");
8require_once("class.killlisttable.php");
9require_once("class.killsummarytable.php");
10require_once("class.box.php");
11require_once("class.toplist.php");
12
13$pilot = new Pilot($_GET['plt_id']);
14$corp = $pilot->getCorp();
15$alliance = $corp->getAlliance();
16$page = new Page("Pilot details - " . $pilot->getName());
17
18if (!$pilot->exists())
19{
20    $html = "That pilot doesn't exist.";
21    $page->generate($html);
22    exit;
23}
24
25$klist = new KillList();
26$tklist = new KillList();
27$llist = new KillList();
28$klist->addInvolvedPilot($pilot);
29$tklist->addInvolvedPilot($pilot);
30$llist->addVictimPilot($pilot);
31$klist->getAllKills();
32$llist->getAllKills();
33$tklist->setPodsNoobShips(false);
34
35$html .= "<table class=kb-table cellspacing=1 width=\"100%\">";
36
37$html .= "<tr class=kb-table-row-even>";
38$html .= "<td rowspan=8 width=128><img src=\"" . $pilot->getPortraitURL(128) . "\" border=\"0\" width=\"128\" heigth=\"128\"></td>";
39
40$html .= "<td class=kb-table-cell width=160><b>Corporation:</b></td><td class=kb-table-cell><a href=\"?a=corp_detail&crp_id=" . $corp->getID() . "\">" . $corp->getName() . "</a></td></tr>";
41$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Alliance:</b></td><td class=kb-table-cell>";
42if ($alliance->getName() == "Unknown" || $alliance->getName() == "None")
43    $html .= "<b>" . $alliance->getName() . "</b>";
44else
45    $html .= "<a href=\"?a=alliance_detail&all_id=" . $alliance->getID() . "\">" . $alliance->getName() . "</a>";
46$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>" . $klist->getCount() . "</td></tr>";
47$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Real kills:</b></td><td class=kl-kill>" . $tklist->getCount() . "</td></tr>";
48$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $llist->getCount() . "</td></tr>";
49$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>" . $klist->getISK() . "M</td></tr>";
50$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>" . $llist->getISK() . "M</td></tr>";
51
52$html .= "</td></tr>";
53$html .= "</table>";
54
55$html .= "<br/>";
56
57$points = $klist->getPoints();
58$summary = new KillSummaryTable($klist, $llist);
59$summary->setBreak(6);
60if ($_GET['view'] == "ships_weapons")
61{
62    $summary->setFilter(false);
63}
64$html .= $summary->generate();
65
66switch ($_GET['view'])
67{
68    case "kills":
69        $html .= "<div class=kb-kills-header>All kills</div>";
70
71        $list = new KillList();
72        $list->setOrdered(true);
73        $list->addInvolvedPilot($pilot);
74        if ($_GET['scl_id'])
75            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
76        $pagesplitter = new PageSplitter($list->getCount(), 30);
77        $list->setPageSplitter($pagesplitter);
78        $table = new KillListTable($list);
79        $table->setDayBreak(false);
80        $html .= $table->generate();
81        $html .= $pagesplitter->generate();
82
83        break;
84    case "losses":
85        $html .= "<div class=kb-losses-header>All losses</div>";
86
87        $list = new KillList();
88        $list->setOrdered(true);
89        $list->setPodsNoobships(true);
90        $list->addVictimPilot($pilot);
91        if ($_GET['scl_id'])
92            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
93        $pagesplitter = new PageSplitter($list->getCount(), 30);
94        $list->setPageSplitter($pagesplitter);
95
96        $table = new KillListTable($list);
97        $table->setDayBreak(false);
98        $html .= $table->generate();
99        $html .= $pagesplitter->generate();
100        break;
101    case "ships_weapons":
102        $html .= "<div class=block-header2>Ships & weapons used</div>";
103
104        $html .= "<table class=kb-subtable><tr><td valign=top width=400>";
105        $shiplist = new TopShipList();
106        $shiplist->addInvolvedPilot($pilot);
107        $shiplisttable = new TopShipListTable($shiplist);
108        $html .= $shiplisttable->generate();
109        $html .= "</td><td valign=top align=right width=400>";
110
111        $weaponlist = new TopWeaponList();
112        $weaponlist->addInvolvedPilot($pilot);
113        $weaponlisttable = new TopWeaponListTable($weaponlist);
114        $html .= $weaponlisttable->generate();
115        $html .= "</td></tr></table>";
116
117        break;
118    default:
119        $html .= "<div class=kb-kills-header>10 Most recent kills</div>";
120        $list = new KillList();
121        $list->setOrdered(true);
122        $list->setLimit(10);
123        $list->setPodsNoobships(true);
124        $list->addInvolvedPilot($pilot);
125        if ($_GET['scl_id'])
126            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
127
128        $table = new KillListTable($list);
129        $table->setDayBreak(false);
130        $html .= $table->generate();
131
132        $html .= "<div class=kb-losses-header>10 Most recent losses</div>";
133        $list = new KillList();
134        $list->setOrdered(true);
135        $list->setLimit(10);
136        $list->setPodsNoobships(true);
137        $list->addVictimPilot($pilot);
138        if ($_GET['scl_id'])
139            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
140
141        $table = new KillListTable($list);
142        $table->setDayBreak(false);
143        $table->setDayBreak(false);
144        $html .= $table->generate();
145        break;
146}
147
148$menubox = new box("Menu");
149$menubox->setIcon("menu-item.gif");
150$menubox->addOption("caption","Kills & losses");
151$menubox->addOption("link","Recent activity", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=recent");
152$menubox->addOption("link","Kills", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=kills");
153$menubox->addOption("link","Losses", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=losses");
154$menubox->addOption("caption","Statistics");
155$menubox->addOption("link","Ships & weapons", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=ships_weapons");
156if (strstr($config->getConfig("mods_active"), 'signature_generator'))
157{
158    $menubox->addOption("caption","Signature");
159    $menubox->addOption("link","Link", "?a=sig_list&i=" . $pilot->getID());
160}
161$page->addContext($menubox->generate());
162
163$killboard = $page->killboard_;
164$config = $killboard->getConfig();
165if ($config->getKillPoints())
166{
167    $scorebox = new Box("Kill points");
168    $scorebox->setOption($points);
169    $page->addContext($scorebox->generate());
170}
171
172$page->setContent($html);
173
174$page->generate();
175?>
Note: See TracBrowser for help on using the browser.