root/dev/common/pilot_detail.php @ 165

Revision 165, 7.0 KB (checked in by exi, 16 years ago)

Added options to show loss and totalpoints in pilot details.
Tidied up class.box.php.
class.kill.php now checks better for item location ids.
Added victimalliancename to the killlisttable.
The signature generator now paints error messages if he doesnt like stuff.

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$lpoints = $llist->getPoints();
59$summary = new KillSummaryTable($klist, $llist);
60$summary->setBreak(6);
61if ($_GET['view'] == "ships_weapons")
62{
63    $summary->setFilter(false);
64}
65$html .= $summary->generate();
66
67switch ($_GET['view'])
68{
69    case "kills":
70        $html .= "<div class=kb-kills-header>All kills</div>";
71
72        $list = new KillList();
73        $list->setOrdered(true);
74        $list->addInvolvedPilot($pilot);
75        if ($_GET['scl_id'])
76            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
77        $pagesplitter = new PageSplitter($list->getCount(), 30);
78        $list->setPageSplitter($pagesplitter);
79        $table = new KillListTable($list);
80        $table->setDayBreak(false);
81        $html .= $table->generate();
82        $html .= $pagesplitter->generate();
83
84        break;
85    case "losses":
86        $html .= "<div class=kb-losses-header>All losses</div>";
87
88        $list = new KillList();
89        $list->setOrdered(true);
90        $list->setPodsNoobships(true);
91        $list->addVictimPilot($pilot);
92        if ($_GET['scl_id'])
93            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
94        $pagesplitter = new PageSplitter($list->getCount(), 30);
95        $list->setPageSplitter($pagesplitter);
96
97        $table = new KillListTable($list);
98        $table->setDayBreak(false);
99        $html .= $table->generate();
100        $html .= $pagesplitter->generate();
101        break;
102    case "ships_weapons":
103        $html .= "<div class=block-header2>Ships & weapons used</div>";
104
105        $html .= "<table class=kb-subtable><tr><td valign=top width=400>";
106        $shiplist = new TopShipList();
107        $shiplist->addInvolvedPilot($pilot);
108        $shiplisttable = new TopShipListTable($shiplist);
109        $html .= $shiplisttable->generate();
110        $html .= "</td><td valign=top align=right width=400>";
111
112        $weaponlist = new TopWeaponList();
113        $weaponlist->addInvolvedPilot($pilot);
114        $weaponlisttable = new TopWeaponListTable($weaponlist);
115        $html .= $weaponlisttable->generate();
116        $html .= "</td></tr></table>";
117
118        break;
119    default:
120        $html .= "<div class=kb-kills-header>10 Most recent kills</div>";
121        $list = new KillList();
122        $list->setOrdered(true);
123        $list->setLimit(10);
124        $list->setPodsNoobships(true);
125        $list->addInvolvedPilot($pilot);
126        if ($_GET['scl_id'])
127            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
128
129        $table = new KillListTable($list);
130        $table->setDayBreak(false);
131        $html .= $table->generate();
132
133        $html .= "<div class=kb-losses-header>10 Most recent losses</div>";
134        $list = new KillList();
135        $list->setOrdered(true);
136        $list->setLimit(10);
137        $list->setPodsNoobships(true);
138        $list->addVictimPilot($pilot);
139        if ($_GET['scl_id'])
140            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
141
142        $table = new KillListTable($list);
143        $table->setDayBreak(false);
144        $table->setDayBreak(false);
145        $html .= $table->generate();
146        break;
147}
148
149$menubox = new box("Menu");
150$menubox->setIcon("menu-item.gif");
151$menubox->addOption("caption","Kills & losses");
152$menubox->addOption("link","Recent activity", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=recent");
153$menubox->addOption("link","Kills", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=kills");
154$menubox->addOption("link","Losses", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=losses");
155$menubox->addOption("caption","Statistics");
156$menubox->addOption("link","Ships & weapons", "?a=pilot_detail&plt_id=" . $pilot->getID() . "&view=ships_weapons");
157if (strstr($config->getConfig("mods_active"), 'signature_generator'))
158{
159    $menubox->addOption("caption","Signature");
160    $menubox->addOption("link","Link", "?a=sig_list&i=" . $pilot->getID());
161}
162$page->addContext($menubox->generate());
163
164if ($config->getKillPoints())
165{
166    $scorebox = new Box("Kill points");
167    $scorebox->addOption("points", $points);
168    $page->addContext($scorebox->generate());
169}
170if ($config->getConfig('loss_points'))
171{
172    $scorebox = new Box("Loss points");
173    $scorebox->addOption("points", $lpoints);
174    $page->addContext($scorebox->generate());
175}
176if ($config->getConfig('total_points'))
177{
178    $scorebox = new Box("Total points");
179    $scorebox->addOption("points", $points-$lpoints);
180    $page->addContext($scorebox->generate());
181}
182
183$page->setContent($html);
184$page->generate();
185?>
Note: See TracBrowser for help on using the browser.