root/dev/common/pilot_detail.php @ 195

Revision 190, 7.1 KB (checked in by exi, 15 years ago)

This is a big update...
Moved all admin scripts to common/admin.
Moved all includes and classes to common/includes.
Edited all include-paths to reflect the movement.
Fixed a bug with the session system allowing every registered user to access admin pages.
Replaced calls to date() to use a wrapper so gmdate can be used.
Replaced some calls to $config with calls to the static object.
Fixed a big which caused the portrait_grab to not download a new picute.
Added a classified-state to kills.
Removed the sync_server server script in this tree.
Added code to help modules find the includes to index.php.

Line 
1<?php
2require_once('common/includes/class.page.php');
3require_once('common/includes/class.pilot.php');
4require_once('common/includes/class.corp.php');
5require_once('common/includes/class.alliance.php');
6require_once('common/includes/class.kill.php');
7require_once('common/includes/class.killlist.php');
8require_once('common/includes/class.killlisttable.php');
9require_once('common/includes/class.killsummarytable.php');
10require_once('common/includes/class.toplist.php');
11
12$pilot = new Pilot($_GET['plt_id']);
13$corp = $pilot->getCorp();
14$alliance = $corp->getAlliance();
15$page = new Page('Pilot details - '.$pilot->getName());
16
17if (!$pilot->exists())
18{
19    $html = 'That pilot doesn\'t exist.';
20    $page->generate($html);
21    exit;
22}
23
24$klist = new KillList();
25$tklist = new KillList();
26$llist = new KillList();
27$klist->addInvolvedPilot($pilot);
28$tklist->addInvolvedPilot($pilot);
29$llist->addVictimPilot($pilot);
30$klist->getAllKills();
31$llist->getAllKills();
32$tklist->setPodsNoobShips(false);
33
34$html .= "<table class=kb-table cellspacing=1 width=\"100%\">";
35
36$html .= "<tr class=kb-table-row-even>";
37$html .= "<td rowspan=8 width=128><img src=\"".$pilot->getPortraitURL(128)."\" border=\"0\" width=\"128\" heigth=\"128\"></td>";
38
39$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>";
40$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Alliance:</b></td><td class=kb-table-cell>";
41if ($alliance->getName() == "Unknown" || $alliance->getName() == "None")
42    $html .= "<b>".$alliance->getName()."</b>";
43else
44    $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>";
45$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$klist->getCount()."</td></tr>";
46$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>";
47$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$llist->getCount()."</td></tr>";
48$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($klist->getISK()/1000000,2)."M</td></tr>";
49$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($llist->getISK()/1000000,2)."M</td></tr>";
50
51$html .= "</td></tr>";
52$html .= "</table>";
53
54$html .= "<br/>";
55
56$points = $klist->getPoints();
57$lpoints = $llist->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::get("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
163if (config::get('kill_points'))
164{
165    $scorebox = new Box("Kill points");
166    $scorebox->addOption("points", $points);
167    $page->addContext($scorebox->generate());
168}
169if (config::get('loss_points'))
170{
171    $scorebox = new Box("Loss points");
172    $scorebox->addOption("points", $lpoints);
173    $page->addContext($scorebox->generate());
174}
175if (config::get('total_points'))
176{
177    $scorebox = new Box("Total points");
178    $scorebox->addOption("points", $points-$lpoints);
179    $page->addContext($scorebox->generate());
180}
181
182$page->setContent($html);
183$page->generate();
184?>
Note: See TracBrowser for help on using the browser.