1 | <?php |
---|
2 | require_once('common/includes/class.page.php'); |
---|
3 | require_once('common/includes/class.corp.php'); |
---|
4 | require_once('common/includes/class.alliance.php'); |
---|
5 | require_once('common/includes/class.killlist.php'); |
---|
6 | require_once('common/includes/class.killlisttable.php'); |
---|
7 | require_once('common/includes/class.killsummarytable.php'); |
---|
8 | require_once('common/includes/class.toplist.php'); |
---|
9 | |
---|
10 | $all_id = $_GET['all_id']; |
---|
11 | $alliance = new Alliance(intval($all_id)); |
---|
12 | $page = new Page('Alliance details - '.$alliance->getName()); |
---|
13 | |
---|
14 | $html .= "<table class=kb-table width=\"100%\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=8 width=128 align=center bgcolor=black>"; |
---|
15 | |
---|
16 | if (file_exists("img/alliances/".$alliance->getUnique().".png")) |
---|
17 | { |
---|
18 | $html .= "<img src=\"".IMG_URL."/alliances/".$alliance->getUnique().".png\" border=\"0\"></td>"; |
---|
19 | } |
---|
20 | else |
---|
21 | { |
---|
22 | $html .= "<img src=\"".IMG_URL."/alliances/default.gif\" border=\"0\"></td>"; |
---|
23 | } |
---|
24 | $kill_summary = new KillSummaryTable(); |
---|
25 | $kill_summary->addInvolvedAlliance($alliance); |
---|
26 | $kill_summary->setBreak(6); |
---|
27 | $summary_html = $kill_summary->generate(); |
---|
28 | |
---|
29 | $html .= "<td class=kb-table-cell width=180><b>Kills:</b></td><td class=kl-kill>".$kill_summary->getTotalKills()."</td></tr>"; |
---|
30 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$kill_summary->getTotalLosses()."</td></tr>"; |
---|
31 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($kill_summary->getTotalKillISK()/1000000, 2)."M</td></tr>"; |
---|
32 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($kill_summary->getTotalLossISK()/1000000, 2)."M</td></tr>"; |
---|
33 | if ($kill_summary->getTotalKillISK()) |
---|
34 | { |
---|
35 | $efficiency = round($kill_summary->getTotalKillISK() / ($kill_summary->getTotalKillISK() + $kill_summary->getTotalLossISK()) * 100, 2); |
---|
36 | } |
---|
37 | else |
---|
38 | { |
---|
39 | $efficiency = 0; |
---|
40 | } |
---|
41 | |
---|
42 | $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>"; |
---|
43 | |
---|
44 | $html .= "</table>"; |
---|
45 | $html .= "<br/>"; |
---|
46 | |
---|
47 | if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses") |
---|
48 | { |
---|
49 | $html .= $summary_html; |
---|
50 | } |
---|
51 | |
---|
52 | switch ($_GET['view']) |
---|
53 | { |
---|
54 | case "": |
---|
55 | $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; |
---|
56 | |
---|
57 | $list = new KillList(); |
---|
58 | $list->setOrdered(true); |
---|
59 | $list->setLimit(10); |
---|
60 | $list->setPodsNoobships(true); |
---|
61 | $list->addInvolvedAlliance($alliance); |
---|
62 | if ($_GET['scl_id']) |
---|
63 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
64 | |
---|
65 | $ktab = new KillListTable($list); |
---|
66 | $ktab->setLimit(10); |
---|
67 | $ktab->setDayBreak(false); |
---|
68 | $html .= $ktab->generate(); |
---|
69 | |
---|
70 | $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; |
---|
71 | |
---|
72 | $list = new KillList(); |
---|
73 | $list->setOrdered(true); |
---|
74 | $list->setLimit(10); |
---|
75 | $list->setPodsNoobships(true); |
---|
76 | $list->addVictimAlliance($alliance); |
---|
77 | if ($_GET['scl_id']) |
---|
78 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
79 | |
---|
80 | $ltab = new KillListTable($list); |
---|
81 | $ltab->setLimit(10); |
---|
82 | $ltab->setDayBreak(false); |
---|
83 | $html .= $ltab->generate(); |
---|
84 | |
---|
85 | break; |
---|
86 | case "kills": |
---|
87 | $html .= "<div class=kb-kills-header>All kills</div>"; |
---|
88 | |
---|
89 | $list = new KillList(); |
---|
90 | $list->setOrdered(true); |
---|
91 | $list->addInvolvedAlliance($alliance); |
---|
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 | $table = new KillListTable($list); |
---|
97 | $table->setDayBreak(false); |
---|
98 | $html .= $table->generate(); |
---|
99 | $html .= $pagesplitter->generate(); |
---|
100 | |
---|
101 | break; |
---|
102 | case "losses": |
---|
103 | $html .= "<div class=kb-losses-header>All losses</div>"; |
---|
104 | |
---|
105 | $list = new KillList(); |
---|
106 | $list->setOrdered(true); |
---|
107 | $list->setPodsNoobships(true); |
---|
108 | $list->addVictimAlliance($alliance); |
---|
109 | if ($_GET['scl_id']) |
---|
110 | $list->addVictimShipClass(new ShipClass($_GET['scl_id'])); |
---|
111 | $pagesplitter = new PageSplitter($list->getCount(), 30); |
---|
112 | $list->setPageSplitter($pagesplitter); |
---|
113 | |
---|
114 | $table = new KillListTable($list); |
---|
115 | $table->setDayBreak(false); |
---|
116 | $html .= $table->generate(); |
---|
117 | $html .= $pagesplitter->generate(); |
---|
118 | |
---|
119 | break; |
---|
120 | case "corp_kills": |
---|
121 | $html .= "<div class=block-header2>Top killers</div>"; |
---|
122 | |
---|
123 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
124 | $html .= "<div class=block-header>This month</div>"; |
---|
125 | |
---|
126 | $list = new TopCorpKillsList(); |
---|
127 | $list->addInvolvedAlliance($alliance); |
---|
128 | $list->setPodsNoobShips(false); |
---|
129 | $list->setMonth(kbdate("m")); |
---|
130 | $list->setYear(kbdate("Y")); |
---|
131 | $table = new TopCorpTable($list, "Kills"); |
---|
132 | $html .= $table->generate(); |
---|
133 | |
---|
134 | $html .= "</td><td valign=top width=400>"; |
---|
135 | $html .= "<div class=block-header>All time</div>"; |
---|
136 | |
---|
137 | $list = new TopCorpKillsList(); |
---|
138 | $list->addInvolvedAlliance($alliance); |
---|
139 | $list->setPodsNoobShips(false); |
---|
140 | $table = new TopCorpTable($list, "Kills"); |
---|
141 | $html .= $table->generate(); |
---|
142 | |
---|
143 | $html .= "</td></tr></table>"; |
---|
144 | |
---|
145 | break; |
---|
146 | case "corp_losses": |
---|
147 | $html .= "<div class=block-header2>Top losers</div>"; |
---|
148 | |
---|
149 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
150 | $html .= "<div class=block-header>This month</div>"; |
---|
151 | |
---|
152 | $list = new TopCorpLossesList(); |
---|
153 | $list->addVictimAlliance($alliance); |
---|
154 | $list->setPodsNoobShips(false); |
---|
155 | $list->setMonth(kbdate("m")); |
---|
156 | $list->setYear(kbdate("Y")); |
---|
157 | $table = new TopCorpTable($list, "Losses"); |
---|
158 | $html .= $table->generate(); |
---|
159 | |
---|
160 | $html .= "</td><td valign=top width=400>"; |
---|
161 | $html .= "<div class=block-header>All time</div>"; |
---|
162 | |
---|
163 | $list = new TopCorpLossesList(); |
---|
164 | $list->addVictimAlliance($alliance); |
---|
165 | $list->setPodsNoobShips(false); |
---|
166 | $table = new TopCorpTable($list, "Losses"); |
---|
167 | $html .= $table->generate(); |
---|
168 | |
---|
169 | $html .= "</td></tr></table>"; |
---|
170 | |
---|
171 | break; |
---|
172 | case "pilot_kills": |
---|
173 | $html .= "<div class=block-header2>Top killers</div>"; |
---|
174 | |
---|
175 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
176 | $html .= "<div class=block-header>This month</div>"; |
---|
177 | |
---|
178 | $list = new TopKillsList(); |
---|
179 | $list->addInvolvedAlliance($alliance); |
---|
180 | $list->setPodsNoobShips(false); |
---|
181 | $list->setMonth(kbdate("m")); |
---|
182 | $list->setYear(kbdate("Y")); |
---|
183 | $table = new TopPilotTable($list, "Kills"); |
---|
184 | $html .= $table->generate(); |
---|
185 | |
---|
186 | $html .= "</td><td valign=top width=400>"; |
---|
187 | $html .= "<div class=block-header>All time</div>"; |
---|
188 | |
---|
189 | $list = new TopKillsList(); |
---|
190 | $list->addInvolvedAlliance($alliance); |
---|
191 | $list->setPodsNoobShips(false); |
---|
192 | $table = new TopPilotTable($list, "Kills"); |
---|
193 | $html .= $table->generate(); |
---|
194 | |
---|
195 | $html .= "</td></tr></table>"; |
---|
196 | |
---|
197 | break; |
---|
198 | case "pilot_scores": |
---|
199 | $html .= "<div class=block-header2>Top scorers</div>"; |
---|
200 | |
---|
201 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
202 | $html .= "<div class=block-header>This month</div>"; |
---|
203 | |
---|
204 | $list = new TopScoreList(); |
---|
205 | $list->addInvolvedAlliance($alliance); |
---|
206 | $list->setPodsNoobShips(true); |
---|
207 | $list->setMonth(kbdate("m")); |
---|
208 | $list->setYear(kbdate("Y")); |
---|
209 | $table = new TopPilotTable($list, "Points"); |
---|
210 | $html .= $table->generate(); |
---|
211 | |
---|
212 | $html .= "</td><td valign=top width=400>"; |
---|
213 | $html .= "<div class=block-header>All time</div>"; |
---|
214 | |
---|
215 | $list = new TopScoreList(); |
---|
216 | $list->addInvolvedAlliance($alliance); |
---|
217 | $list->setPodsNoobShips(true); |
---|
218 | $table = new TopPilotTable($list, "Points"); |
---|
219 | $html .= $table->generate(); |
---|
220 | |
---|
221 | $html .= "</td></tr></table>"; |
---|
222 | |
---|
223 | break; |
---|
224 | case "pilot_losses": |
---|
225 | $html .= "<div class=block-header2>Top losers</div>"; |
---|
226 | |
---|
227 | $html .= "<table class=kb-subtable><tr><td valign=top width=440>"; |
---|
228 | $html .= "<div class=block-header>This month</div>"; |
---|
229 | |
---|
230 | $list = new TopLossesList(); |
---|
231 | $list->addVictimAlliance($alliance); |
---|
232 | $list->setPodsNoobShips(false); |
---|
233 | $list->setMonth(kbdate("m")); |
---|
234 | $list->setYear(kbdate("Y")); |
---|
235 | $table = new TopPilotTable($list, "Losses"); |
---|
236 | $html .= $table->generate(); |
---|
237 | |
---|
238 | $html .= "</td><td valign=top width=400>"; |
---|
239 | $html .= "<div class=block-header>All time</div>"; |
---|
240 | |
---|
241 | $list = new TopLossesList(); |
---|
242 | $list->addVictimAlliance($alliance); |
---|
243 | $list->setPodsNoobShips(false); |
---|
244 | $table = new TopPilotTable($list, "Losses"); |
---|
245 | $html .= $table->generate(); |
---|
246 | |
---|
247 | $html .= "</td></tr></table>"; |
---|
248 | |
---|
249 | break; |
---|
250 | case "ships_weapons": |
---|
251 | $html .= "<div class=block-header2>Ships & weapons used</div>"; |
---|
252 | |
---|
253 | $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; |
---|
254 | $shiplist = new TopShipList(); |
---|
255 | $shiplist->addInvolvedAlliance($alliance); |
---|
256 | $shiplisttable = new TopShipListTable($shiplist); |
---|
257 | $html .= $shiplisttable->generate(); |
---|
258 | $html .= "</td><td valign=top align=right width=400>"; |
---|
259 | |
---|
260 | $weaponlist = new TopWeaponList(); |
---|
261 | $weaponlist->addInvolvedAlliance($alliance); |
---|
262 | $weaponlisttable = new TopWeaponListTable($weaponlist); |
---|
263 | $html .= $weaponlisttable->generate(); |
---|
264 | $html .= "</td></tr></table>"; |
---|
265 | |
---|
266 | break; |
---|
267 | case 'violent_systems': |
---|
268 | $html .= "<div class=block-header2>Most violent systems</div>"; |
---|
269 | $html .= "<table width=\"99%\"><tr><td align=center valign=top>"; |
---|
270 | |
---|
271 | $html .= "<div class=block-header>This month</div>"; |
---|
272 | $html .= "<table class=kb-table>"; |
---|
273 | $html .= "<tr class=kb-table-header><td>#</td><td width=180>System</td><td width=40 align=center >Kills</td></tr>"; |
---|
274 | |
---|
275 | $sql = "select sys.sys_name, sys.sys_sec, sys.sys_id, count(distinct kll.kll_id) as kills |
---|
276 | from kb3_systems sys, kb3_kills kll, kb3_inv_detail inv |
---|
277 | where kll.kll_system_id = sys.sys_id |
---|
278 | and inv.ind_kll_id = kll.kll_id"; |
---|
279 | |
---|
280 | if ($crp_id) |
---|
281 | $sql .= " and inv.ind_crp_id in (".$crp_id.")"; |
---|
282 | if ($all_id) |
---|
283 | $sql .= " and inv.ind_all_id = ".$all_id; |
---|
284 | |
---|
285 | $sql .= " and date_format( kll.kll_timestamp, \"%c\" ) = ".kbdate("m")." |
---|
286 | and date_format( kll.kll_timestamp, \"%Y\" ) = ".kbdate("Y")." |
---|
287 | group by sys.sys_name |
---|
288 | order by kills desc |
---|
289 | limit 25"; |
---|
290 | |
---|
291 | $qry = new DBQuery(); |
---|
292 | $qry->execute($sql); |
---|
293 | $odd = false; |
---|
294 | $counter = 1; |
---|
295 | while ($row = $qry->getRow()) |
---|
296 | { |
---|
297 | if (!$odd) |
---|
298 | { |
---|
299 | $odd = true; |
---|
300 | $rowclass = 'kb-table-row-odd'; |
---|
301 | } |
---|
302 | else |
---|
303 | { |
---|
304 | $odd = false; |
---|
305 | $rowclass = 'kb-table-row-even'; |
---|
306 | } |
---|
307 | |
---|
308 | $html .= "<tr class=".$rowclass."><td><b>".$counter.".</b></td><td class=kb-table-cell width=180><b><a href=\"?a=system_detail&sys_id=".$row['sys_id']."\">".$row['sys_name']."</a></b> (".roundsec($row['sys_sec']).")</td><td align=center>".$row['kills']."</td></tr>"; |
---|
309 | $counter++; |
---|
310 | } |
---|
311 | |
---|
312 | $html .= "</table>"; |
---|
313 | |
---|
314 | $html .= "</td><td align=center valign=top>"; |
---|
315 | $html .= "<div class=block-header>All-Time</div>"; |
---|
316 | $html .= "<table class=kb-table>"; |
---|
317 | $html .= "<tr class=kb-table-header><td>#</td><td width=180>System</td><td width=40 align=center>Kills</td></tr>"; |
---|
318 | |
---|
319 | $sql = "select sys.sys_name, sys.sys_id, sys.sys_sec, count(distinct kll.kll_id) as kills |
---|
320 | from kb3_systems sys, kb3_kills kll, kb3_inv_detail inv |
---|
321 | where kll.kll_system_id = sys.sys_id |
---|
322 | and inv.ind_kll_id = kll.kll_id"; |
---|
323 | |
---|
324 | if ($crp_id) |
---|
325 | $sql .= " and inv.ind_crp_id in (".$crp_id.")"; |
---|
326 | if ($all_id) |
---|
327 | $sql .= " and inv.ind_all_id = ".$all_id; |
---|
328 | |
---|
329 | $sql .= " group by sys.sys_name |
---|
330 | order by kills desc |
---|
331 | limit 25"; |
---|
332 | |
---|
333 | $qry = new DBQuery(); |
---|
334 | $qry->execute($sql); |
---|
335 | $odd = false; |
---|
336 | $counter = 1; |
---|
337 | while ($row = $qry->getRow()) |
---|
338 | { |
---|
339 | if (!$odd) |
---|
340 | { |
---|
341 | $odd = true; |
---|
342 | $rowclass = 'kb-table-row-odd'; |
---|
343 | } |
---|
344 | else |
---|
345 | { |
---|
346 | $odd = false; |
---|
347 | $rowclass = 'kb-table-row-even'; |
---|
348 | } |
---|
349 | |
---|
350 | $html .= "<tr class=".$rowclass."><td><b>".$counter.".</b></td><td class=kb-table-cell><b><a href=\"?a=system_detail&sys_id=".$row['sys_id']."\">".$row['sys_name']."</a></b> (".roundsec($row['sys_sec']).")</td><td align=center>".$row['kills']."</td></tr>"; |
---|
351 | $counter++; |
---|
352 | } |
---|
353 | $html .= "</table>"; |
---|
354 | $html .= "</td></tr></table>"; |
---|
355 | break; |
---|
356 | } |
---|
357 | |
---|
358 | $menubox = new Box("Menu"); |
---|
359 | $menubox->setIcon("menu-item.gif"); |
---|
360 | $menubox->addOption("caption","Kills & losses"); |
---|
361 | $menubox->addOption("link","Recent activity", "?a=alliance_detail&all_id=" . $alliance->getID()); |
---|
362 | $menubox->addOption("link","Kills", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=kills"); |
---|
363 | $menubox->addOption("link","Losses", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=losses"); |
---|
364 | $menubox->addOption("caption","Corp statistics"); |
---|
365 | $menubox->addOption("link","Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_kills"); |
---|
366 | $menubox->addOption("link","Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_losses"); |
---|
367 | |
---|
368 | $menubox->addOption("caption","Pilot statistics"); |
---|
369 | $menubox->addOption("link","Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_kills"); |
---|
370 | if ($config->getConfig('kill_points')) |
---|
371 | { |
---|
372 | $menubox->addOption('link', "Top scorers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_scores"); |
---|
373 | } |
---|
374 | $menubox->addOption("link","Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_losses"); |
---|
375 | $menubox->addOption("caption","Global statistics"); |
---|
376 | $menubox->addOption("link","Ships & weapons", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=ships_weapons"); |
---|
377 | $menubox->addOption("link","Most violent systems", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=violent_systems"); |
---|
378 | $page->addContext($menubox->generate()); |
---|
379 | |
---|
380 | $page->setContent($html); |
---|
381 | $page->generate(); |
---|
382 | ?> |
---|