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