1 | <?php |
---|
2 | require_once("common/db.php"); |
---|
3 | require_once("common/class.page.php"); |
---|
4 | require_once("common/class.corp.php"); |
---|
5 | require_once("common/class.alliance.php"); |
---|
6 | require_once("common/class.killlist.php"); |
---|
7 | require_once("common/class.killlisttable.php"); |
---|
8 | require_once("common/class.killsummarytable.php"); |
---|
9 | require_once("common/class.box.php"); |
---|
10 | require_once("common/class.toplist.php"); |
---|
11 | |
---|
12 | $corp = new Corporation(intval($_GET['crp_id'])); |
---|
13 | $alliance = $corp->getAlliance(); |
---|
14 | |
---|
15 | $klist = new KillList(); |
---|
16 | $tklist = new KillList(); |
---|
17 | $llist = new KillList(); |
---|
18 | $klist->addInvolvedCorp($corp); |
---|
19 | $tklist->addInvolvedCorp($corp); |
---|
20 | $tklist->setPodsNoobShips(false); |
---|
21 | $llist->addVictimCorp($corp); |
---|
22 | $klist->getAllKills(); |
---|
23 | $llist->getAllKills(); |
---|
24 | |
---|
25 | $page = new Page("Corporation details - " . $corp->getName()); |
---|
26 | $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center>"; |
---|
27 | |
---|
28 | if (file_exists("img/corps/".$corp->getID().".jpg")) |
---|
29 | { |
---|
30 | $html .= "<img src=\"".$corp->getPortraitURL(128)."\" border=\"0\"></td>"; |
---|
31 | } |
---|
32 | else |
---|
33 | { |
---|
34 | $html .= "<img src=\"" . IMG_URL . "/campaign-big.gif\" border=\"0\"></td>"; |
---|
35 | } |
---|
36 | |
---|
37 | // $html .= "</tr>"; |
---|
38 | $html .= "<td class=kb-table-cell width=180><b>Alliance:</b></td><td class=kb-table-cell>"; |
---|
39 | if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") |
---|
40 | $html .= "<b>" . $alliance->getName() . "</b>"; |
---|
41 | else |
---|
42 | $html .= "<a href=\"?a=alliance_detail&all_id=" . $alliance->getID() . "\">" . $alliance->getName() . "</a>"; |
---|
43 | $html .= "</td></tr>"; |
---|
44 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>" . $klist->getCount() . "</td></tr>"; |
---|
45 | $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>"; |
---|
46 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $llist->getCount() . "</td></tr>"; |
---|
47 | $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>"; |
---|
48 | $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>"; |
---|
49 | if ($klist->getISK()) |
---|
50 | $efficiency = round($klist->getISK() / ($klist->getISK() + $llist->getISK()) * 100, 2); |
---|
51 | else |
---|
52 | $efficiency = 0; |
---|
53 | |
---|
54 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>" . $efficiency . "%</b></td></tr>"; |
---|
55 | |
---|
56 | $html .= "</table>"; |
---|
57 | |
---|
58 | $html .= "<br/>"; |
---|
59 | |
---|
60 | if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") |
---|
61 | { |
---|
62 | $summarytable = new KillSummaryTable($klist, $llist); |
---|
63 | $summarytable->setBreak(6); |
---|
64 | |
---|
65 | $html .= $summarytable->generate(); |
---|
66 | } |
---|
67 | |
---|
68 | switch ($_GET['view']) |
---|
69 | { |
---|
70 | case "": |
---|
71 | $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; |
---|
72 | |
---|
73 | $list = new KillList(); |
---|
74 | $list->setOrdered(true); |
---|
75 | $list->setLimit(10); |
---|
76 | $list->setPodsNoobships(true); |
---|
77 | $list->addInvolvedCorp($corp); |
---|
78 | if ($_GET['scl_id']) |
---|
79 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
80 | |
---|
81 | $ktab = new KillListTable($list); |
---|
82 | $ktab->setLimit(10); |
---|
83 | $ktab->setDayBreak(false); |
---|
84 | $html .= $ktab->generate(); |
---|
85 | |
---|
86 | $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; |
---|
87 | |
---|
88 | $list = new KillList(); |
---|
89 | $list->setOrdered(true); |
---|
90 | $list->setLimit(10); |
---|
91 | $list->setPodsNoobships(true); |
---|
92 | $list->addVictimCorp($corp); |
---|
93 | if ($_GET['scl_id']) |
---|
94 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
95 | |
---|
96 | $ltab = new KillListTable($list); |
---|
97 | $ltab->setLimit(10); |
---|
98 | $ltab->setDayBreak(false); |
---|
99 | $html .= $ltab->generate(); |
---|
100 | |
---|
101 | break; |
---|
102 | case "kills": |
---|
103 | $html .= "<div class=kb-kills-header>All kills</div>"; |
---|
104 | |
---|
105 | $list = new KillList(); |
---|
106 | $list->setOrdered(true); |
---|
107 | $list->addInvolvedCorp($corp); |
---|
108 | if ($_GET['scl_id']) |
---|
109 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
110 | $pagesplitter = new PageSplitter($list->getCount(), 30); |
---|
111 | $list->setPageSplitter($pagesplitter); |
---|
112 | $table = new KillListTable($list); |
---|
113 | $table->setDayBreak(false); |
---|
114 | $html .= $table->generate(); |
---|
115 | $html .= $pagesplitter->generate(); |
---|
116 | |
---|
117 | break; |
---|
118 | case "losses": |
---|
119 | $html .= "<div class=kb-losses-header>All losses</div>"; |
---|
120 | |
---|
121 | $list = new KillList(); |
---|
122 | $list->setOrdered(true); |
---|
123 | $list->setPodsNoobships(true); |
---|
124 | $list->addVictimCorp($corp); |
---|
125 | if ($_GET['scl_id']) |
---|
126 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
127 | $pagesplitter = new PageSplitter($list->getCount(), 30); |
---|
128 | $list->setPageSplitter($pagesplitter); |
---|
129 | |
---|
130 | $table = new KillListTable($list); |
---|
131 | $table->setDayBreak(false); |
---|
132 | $html .= $table->generate(); |
---|
133 | $html .= $pagesplitter->generate(); |
---|
134 | |
---|
135 | break; |
---|
136 | case "pilot_kills": |
---|
137 | $html .= "<div class=block-header2>Top killers</div>"; |
---|
138 | |
---|
139 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
140 | $html .= "<div class=block-header>This month</div>"; |
---|
141 | |
---|
142 | $list = new TopKillsList(); |
---|
143 | $list->addInvolvedCorp($corp); |
---|
144 | $list->setPodsNoobShips(false); |
---|
145 | $list->setMonth(date("m")); |
---|
146 | $list->setYear(date("Y")); |
---|
147 | $table = new TopPilotTable($list, "Kills"); |
---|
148 | $html .= $table->generate(); |
---|
149 | |
---|
150 | $html .= "</td><td valign=top width=400>"; |
---|
151 | $html .= "<div class=block-header>All time</div>"; |
---|
152 | |
---|
153 | $list = new TopKillsList(); |
---|
154 | $list->addInvolvedCorp($corp); |
---|
155 | $list->setPodsNoobShips(false); |
---|
156 | $table = new TopPilotTable($list, "Kills"); |
---|
157 | $html .= $table->generate(); |
---|
158 | |
---|
159 | $html .= "</td></tr></table>"; |
---|
160 | |
---|
161 | break; |
---|
162 | case "pilot_scores": |
---|
163 | $html .= "<div class=block-header2>Top scorers</div>"; |
---|
164 | |
---|
165 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
166 | $html .= "<div class=block-header>This month</div>"; |
---|
167 | |
---|
168 | $list = new TopScoreList(); |
---|
169 | $list->addInvolvedCorp($corp); |
---|
170 | $list->setPodsNoobShips(false); |
---|
171 | $list->setMonth(date("m")); |
---|
172 | $list->setYear(date("Y")); |
---|
173 | $table = new TopPilotTable($list, "Points"); |
---|
174 | $html .= $table->generate(); |
---|
175 | |
---|
176 | $html .= "</td><td valign=top width=400>"; |
---|
177 | $html .= "<div class=block-header>All time</div>"; |
---|
178 | |
---|
179 | $list = new TopScoreList(); |
---|
180 | $list->addInvolvedCorp($corp); |
---|
181 | $list->setPodsNoobShips(false); |
---|
182 | $table = new TopPilotTable($list, "Points"); |
---|
183 | $html .= $table->generate(); |
---|
184 | |
---|
185 | $html .= "</td></tr></table>"; |
---|
186 | |
---|
187 | break; |
---|
188 | case "pilot_solo": |
---|
189 | $html .= "<div class=block-header2>Top solokillers</div>"; |
---|
190 | |
---|
191 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
192 | $html .= "<div class=block-header>This month</div>"; |
---|
193 | |
---|
194 | $list = new TopSoloKillerList(); |
---|
195 | $list->addInvolvedCorp($corp); |
---|
196 | $list->setPodsNoobShips(false); |
---|
197 | $list->setMonth(date("m")); |
---|
198 | $list->setYear(date("Y")); |
---|
199 | $table = new TopPilotTable($list, "Solokills"); |
---|
200 | $html .= $table->generate(); |
---|
201 | |
---|
202 | $html .= "</td><td valign=top width=400>"; |
---|
203 | $html .= "<div class=block-header>All time</div>"; |
---|
204 | |
---|
205 | $list = new TopSoloKillerList(); |
---|
206 | $list->addInvolvedCorp($corp); |
---|
207 | $list->setPodsNoobShips(false); |
---|
208 | $table = new TopPilotTable($list, "Solokills"); |
---|
209 | $html .= $table->generate(); |
---|
210 | |
---|
211 | $html .= "</td></tr></table>"; |
---|
212 | |
---|
213 | break; |
---|
214 | |
---|
215 | case "pilot_damage": |
---|
216 | $html .= "<div class=block-header2>Top damagedealers</div>"; |
---|
217 | |
---|
218 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
219 | $html .= "<div class=block-header>This month</div>"; |
---|
220 | |
---|
221 | $list = new TopDamageDealerList(); |
---|
222 | $list->addInvolvedCorp($corp); |
---|
223 | $list->setPodsNoobShips(false); |
---|
224 | $list->setMonth(date("m")); |
---|
225 | $list->setYear(date("Y")); |
---|
226 | $table = new TopPilotTable($list, "Kills"); |
---|
227 | $html .= $table->generate(); |
---|
228 | |
---|
229 | $html .= "</td><td valign=top width=400>"; |
---|
230 | $html .= "<div class=block-header>All time</div>"; |
---|
231 | |
---|
232 | $list = new TopDamageDealerList(); |
---|
233 | $list->addInvolvedCorp($corp); |
---|
234 | $list->setPodsNoobShips(false); |
---|
235 | $table = new TopPilotTable($list, "Kills"); |
---|
236 | $html .= $table->generate(); |
---|
237 | |
---|
238 | $html .= "</td></tr></table>"; |
---|
239 | |
---|
240 | break; |
---|
241 | |
---|
242 | case "pilot_griefer": |
---|
243 | $html .= "<div class=block-header2>Top griefers</div>"; |
---|
244 | |
---|
245 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
246 | $html .= "<div class=block-header>This month</div>"; |
---|
247 | |
---|
248 | $list = new TopGrieferList(); |
---|
249 | $list->addInvolvedCorp($corp); |
---|
250 | $list->setMonth(date("m")); |
---|
251 | $list->setYear(date("Y")); |
---|
252 | $table = new TopPilotTable($list, "Kills"); |
---|
253 | $html .= $table->generate(); |
---|
254 | |
---|
255 | $html .= "</td><td valign=top width=400>"; |
---|
256 | $html .= "<div class=block-header>All time</div>"; |
---|
257 | |
---|
258 | $list = new TopGrieferList(); |
---|
259 | $list->addInvolvedCorp($corp); |
---|
260 | $table = new TopPilotTable($list, "Kills"); |
---|
261 | $html .= $table->generate(); |
---|
262 | |
---|
263 | $html .= "</td></tr></table>"; |
---|
264 | |
---|
265 | break; |
---|
266 | |
---|
267 | case "pilot_losses": |
---|
268 | $html .= "<div class=block-header2>Top losers</div>"; |
---|
269 | |
---|
270 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
271 | $html .= "<div class=block-header>This month</div>"; |
---|
272 | |
---|
273 | $list = new TopLossesList(); |
---|
274 | $list->addVictimCorp($corp); |
---|
275 | $list->setPodsNoobShips(false); |
---|
276 | $list->setMonth(date("m")); |
---|
277 | $list->setYear(date("Y")); |
---|
278 | $table = new TopPilotTable($list, "Losses"); |
---|
279 | $html .= $table->generate(); |
---|
280 | |
---|
281 | $html .= "</td><td valign=top width=400>"; |
---|
282 | $html .= "<div class=block-header>All time</div>"; |
---|
283 | |
---|
284 | $list = new TopLossesList(); |
---|
285 | $list->addVictimCorp($corp); |
---|
286 | $list->setPodsNoobShips(false); |
---|
287 | $table = new TopPilotTable($list, "Losses"); |
---|
288 | $html .= $table->generate(); |
---|
289 | |
---|
290 | $html .= "</td></tr></table>"; |
---|
291 | |
---|
292 | break; |
---|
293 | case "ships_weapons": |
---|
294 | $html .= "<div class=block-header2>Ships & weapons used</div>"; |
---|
295 | |
---|
296 | $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; |
---|
297 | $shiplist = new TopShipList(); |
---|
298 | $shiplist->addInvolvedCorp($corp); |
---|
299 | $shiplisttable = new TopShipListTable($shiplist); |
---|
300 | $html .= $shiplisttable->generate(); |
---|
301 | $html .= "</td><td valign=top align=right width=400>"; |
---|
302 | |
---|
303 | $weaponlist = new TopWeaponList(); |
---|
304 | $weaponlist->addInvolvedCorp($corp); |
---|
305 | $weaponlisttable = new TopWeaponListTable($weaponlist); |
---|
306 | $html .= $weaponlisttable->generate(); |
---|
307 | $html .= "</td></tr></table>"; |
---|
308 | |
---|
309 | break; |
---|
310 | |
---|
311 | |
---|
312 | case "known_members": |
---|
313 | if($config->getConfig('known_members_own')) |
---|
314 | { |
---|
315 | $alliance->getID(); |
---|
316 | if (ALLIANCE_ID && $alliance->getID() == ALLIANCE_ID) |
---|
317 | { |
---|
318 | $can_view = 1; |
---|
319 | } |
---|
320 | elseif (CORP_ID && $corp->getID() == CORP_ID) |
---|
321 | { |
---|
322 | $can_view = 1; |
---|
323 | } |
---|
324 | |
---|
325 | } |
---|
326 | |
---|
327 | |
---|
328 | |
---|
329 | if($can_view == 1) |
---|
330 | { |
---|
331 | $html .= "Cannot View this corps Member List"; |
---|
332 | } |
---|
333 | else |
---|
334 | { |
---|
335 | $query = "SELECT * FROM `kb3_pilots` WHERE plt_crp_id =".intval($_GET['crp_id'])." ORDER BY `plt_name` ASC"; |
---|
336 | $qry = new DBQuery(); |
---|
337 | $qry->execute($query); |
---|
338 | |
---|
339 | $html .= "<div class=block-header2>Known Pilots</div>"; |
---|
340 | $html .= "<table class=kb-table>"; |
---|
341 | $html .= '<tr class=kb-table-header>'; |
---|
342 | $html .= '<td class=kb-table-header align="center"></td>'; |
---|
343 | $html .= '<td class=kb-table-header align="center">Pilot</td>'; |
---|
344 | $html .= '<td class=kb-table-header align="center">Kill Points</td>'; |
---|
345 | $html .= '<td class=kb-table-header align="center">Loss Points</td></tr>'; |
---|
346 | while ($data = $qry->getRow()) |
---|
347 | { |
---|
348 | $pilot = new Pilot( $data['plt_id'] ); |
---|
349 | if (!$odd) |
---|
350 | { |
---|
351 | $odd = true; |
---|
352 | $class = 'kb-table-row-odd'; |
---|
353 | } |
---|
354 | else |
---|
355 | { |
---|
356 | $odd = false; |
---|
357 | $class = 'kb-table-row-even'; |
---|
358 | } |
---|
359 | $html .= "<tr class=".$class." style=\"height: 32px;\">"; |
---|
360 | $html .= '<td width="64" align="center"><img src='.$pilot->getPortraitURL( 32 ).'></td>'; |
---|
361 | $html .= '<td align="center"><a href=?a=pilot_detail&plt_id='.$data['plt_id'].'>'.$data['plt_name'].'</a></td>'; |
---|
362 | $html .= '<td align="center">'.$data['plt_killpoints'].'</td>'; |
---|
363 | $html .= '<td align="center">'.$data['plt_losspoints'].'</td></tr>'; |
---|
364 | } |
---|
365 | |
---|
366 | $html .='</table>'; |
---|
367 | } |
---|
368 | break; |
---|
369 | } |
---|
370 | |
---|
371 | $menubox = new MenuBox(); |
---|
372 | $menubox->addCaption("Kills & losses"); |
---|
373 | $menubox->addOption("Recent activity", "?a=corp_detail&crp_id=" . $corp->getID()); |
---|
374 | $menubox->addOption("Kills", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=kills"); |
---|
375 | $menubox->addOption("Losses", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=losses"); |
---|
376 | $menubox->addCaption("Pilot statistics"); |
---|
377 | $menubox->addOption("Top killers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_kills"); |
---|
378 | |
---|
379 | $killboard = $page->killboard_; |
---|
380 | $config = $killboard->getConfig(); |
---|
381 | if ($config->getKillPoints()) |
---|
382 | $menubox->addOption("Top scorers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_scores"); |
---|
383 | $menubox->addOption("Top solokillers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_solo"); |
---|
384 | $menubox->addOption("Top damagedealers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_damage"); |
---|
385 | $menubox->addOption("Top griefers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_griefer"); |
---|
386 | $menubox->addOption("Top losers", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=pilot_losses"); |
---|
387 | $menubox->addCaption("Global statistics"); |
---|
388 | $menubox->addOption("Ships & weapons", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=ships_weapons"); |
---|
389 | $menubox->addOption("Known Members", "?a=corp_detail&crp_id=" . $corp->getID() . "&view=known_members"); |
---|
390 | $page->addContext($menubox->generate()); |
---|
391 | $page->setContent($html); |
---|
392 | $page->generate(); |
---|
393 | ?> |
---|