root/dev/common/alliance_detail.php @ 10

Revision 10, 10.7 KB (checked in by exi, 15 years ago)

Changed portrait generation to cache the pictures from img.eve.is
Changed about-page-spacing
Changed MapView? to use PNG instead of GIF
Added BugCompat? to MapView? for the GD<>imagefilledellipse()-Issue
Added Code for NPC-Corphandling (Corps have to be added manually)
Changed Raw-Killmail Window slightly
Added Killmail-Delete option within the killmail itself
Fixed privilege bug between admin and superadmin
Removed the need to enter the postpassword if you're logged in as admin
Changed coding style to Allman/BSD in all touched files
Various small changes i cant remember

Line 
1<?php
2require_once("db.php");
3require_once("class.page.php");
4require_once("class.corp.php");
5require_once("class.alliance.php");
6require_once("class.killlist.php");
7require_once("class.killlisttable.php");
8require_once("class.killsummarytable.php");
9require_once("class.box.php");
10require_once("class.toplist.php");
11
12$alliance = new Alliance($_GET['all_id']);
13$klist = new KillList();
14$klist->setOrdered(false);
15// $tklist = new KillList();
16// $tklist->setOrdered( false );
17$llist = new KillList();
18$llist->setOrdered(false);
19$klist->addInvolvedAlliance($alliance);
20// $tklist->addInvolvedAlliance( $alliance );
21// $tklist->setPodsNoobShips( false );
22$llist->addVictimAlliance($alliance);
23$klist->getAllKills();
24$llist->getAllKills();
25
26$page = new Page("Alliance details - " . $alliance->getName());
27
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$html .= "<img src=\"" . IMG_URL . "/alliances/default.gif\" border=\"0\">";
31$html .= "</td>";
32
33$html .= "<td class=kb-table-cell width=180><b>Kills:</b></td><td class=kl-kill>" . $klist->getCount() . "</td></tr>";
34// $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>";
35$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>" . $llist->getCount() . "</td></tr>";
36$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>";
37$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>";
38if ($klist->getISK())
39    $efficiency = round($klist->getISK() / ($klist->getISK() + $llist->getISK()) * 100, 2);
40else
41    $efficiency = 0;
42
43$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>";
44
45$html .= "</table>";
46$html .= "<br/>";
47
48if ($_GET['view'] == "" || $_GET['view'] == "kills" || $_GET['view'] == "losses")
49{
50    $summarytable = new KillSummaryTable($klist, $llist);
51    $summarytable->setBreak(6);
52
53    $html .= $summarytable->generate();
54}
55
56switch ($_GET['view'])
57{
58    case "":
59        $html .= "<div class=kb-kills-header>10 Most recent kills</div>";
60
61        $list = new KillList();
62        $list->setOrdered(true);
63        $list->setLimit(10);
64        $list->setPodsNoobships(true);
65        $list->addInvolvedAlliance($alliance);
66        if ($_GET['scl_id'])
67            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
68
69        $ktab = new KillListTable($list);
70        $ktab->setLimit(10);
71        $ktab->setDayBreak(false);
72        $html .= $ktab->generate();
73
74        $html .= "<div class=kb-losses-header>10 Most recent losses</div>";
75
76        $list = new KillList();
77        $list->setLimit(10);
78        $list->setPodsNoobships(true);
79        $list->addVictimAlliance($alliance);
80        if ($_GET['scl_id'])
81            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
82
83        $ltab = new KillListTable($list);
84        $ltab->setLimit(10);
85        $ltab->setDayBreak(false);
86        $html .= $ltab->generate();
87
88        break;
89    case "kills":
90        $html .= "<div class=kb-kills-header>All kills</div>";
91
92        $list = new KillList();
93        $list->setOrdered(true);
94        $list->addInvolvedAlliance($alliance);
95        if ($_GET['scl_id'])
96            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
97        $pagesplitter = new PageSplitter($list->getCount(), 30);
98        $list->setPageSplitter($pagesplitter);
99        $table = new KillListTable($list);
100        $table->setDayBreak(false);
101        $html .= $table->generate();
102        $html .= $pagesplitter->generate();
103
104        break;
105    case "losses":
106        $html .= "<div class=kb-losses-header>All losses</div>";
107
108        $list = new KillList();
109        $list->setOrdered(true);
110        $list->setPodsNoobships(true);
111        $list->addVictimAlliance($alliance);
112        if ($_GET['scl_id'])
113            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
114        $pagesplitter = new PageSplitter($list->getCount(), 30);
115        $list->setPageSplitter($pagesplitter);
116
117        $table = new KillListTable($list);
118        $table->setDayBreak(false);
119        $html .= $table->generate();
120        $html .= $pagesplitter->generate();
121
122        break;
123    case "corp_kills":
124        $html .= "<div class=block-header2>Top killers</div>";
125
126        $html .= "<table class=kb-subtable><tr><td valign=top width=440>";
127        $html .= "<div class=block-header>This month</div>";
128
129        $list = new TopCorpKillsList();
130        $list->addInvolvedAlliance($alliance);
131        $list->setPodsNoobShips(false);
132        $list->setMonth(date("m"));
133        $list->setYear(date("Y"));
134        $table = new TopCorpTable($list, "Kills");
135        $html .= $table->generate();
136
137        $html .= "</td><td valign=top width=400>";
138        $html .= "<div class=block-header>All time</div>";
139
140        $list = new TopCorpKillsList();
141        $list->addInvolvedAlliance($alliance);
142        $list->setPodsNoobShips(false);
143        $table = new TopCorpTable($list, "Kills");
144        $html .= $table->generate();
145
146        $html .= "</td></tr></table>";
147
148        break;
149    case "corp_losses":
150        $html .= "<div class=block-header2>Top losers</div>";
151
152        $html .= "<table class=kb-subtable><tr><td valign=top width=440>";
153        $html .= "<div class=block-header>This month</div>";
154
155        $list = new TopCorpLossesList();
156        $list->addVictimAlliance($alliance);
157        $list->setPodsNoobShips(false);
158        $list->setMonth(date("m"));
159        $list->setYear(date("Y"));
160        $table = new TopCorpTable($list, "Losses");
161        $html .= $table->generate();
162
163        $html .= "</td><td valign=top width=400>";
164        $html .= "<div class=block-header>All time</div>";
165
166        $list = new TopCorpLossesList();
167        $list->addVictimAlliance($alliance);
168        $list->setPodsNoobShips(false);
169        $table = new TopCorpTable($list, "Losses");
170        $html .= $table->generate();
171
172        $html .= "</td></tr></table>";
173
174        break;
175    case "pilot_kills":
176        $html .= "<div class=block-header2>Top killers</div>";
177
178        $html .= "<table class=kb-subtable><tr><td valign=top width=440>";
179        $html .= "<div class=block-header>This month</div>";
180
181        $list = new TopKillsList();
182        $list->addInvolvedAlliance($alliance);
183        $list->setPodsNoobShips(false);
184        $list->setMonth(date("m"));
185        $list->setYear(date("Y"));
186        $table = new TopPilotTable($list, "Kills");
187        $html .= $table->generate();
188
189        $html .= "</td><td valign=top width=400>";
190        $html .= "<div class=block-header>All time</div>";
191
192        $list = new TopKillsList();
193        $list->addInvolvedAlliance($alliance);
194        $list->setPodsNoobShips(false);
195        $table = new TopPilotTable($list, "Kills");
196        $html .= $table->generate();
197
198        $html .= "</td></tr></table>";
199
200        break;
201    case "pilot_scores":
202        $html .= "<div class=block-header2>Top scorers</div>";
203
204        $html .= "<table class=kb-subtable><tr><td valign=top width=440>";
205        $html .= "<div class=block-header>This month</div>";
206
207        $list = new TopScoreList();
208        $list->addInvolvedAlliance($alliance);
209        $list->setPodsNoobShips(false);
210        $list->setMonth(date("m"));
211        $list->setYear(date("Y"));
212        $table = new TopPilotTable($list, "Points");
213        $html .= $table->generate();
214
215        $html .= "</td><td valign=top width=400>";
216        $html .= "<div class=block-header>All time</div>";
217
218        $list = new TopScoreList();
219        $list->addInvolvedAlliance($alliance);
220        $list->setPodsNoobShips(false);
221        $table = new TopPilotTable($list, "Points");
222        $html .= $table->generate();
223
224        $html .= "</td></tr></table>";
225
226        break;
227    case "pilot_losses":
228        $html .= "<div class=block-header2>Top losers</div>";
229
230        $html .= "<table class=kb-subtable><tr><td valign=top width=440>";
231        $html .= "<div class=block-header>This month</div>";
232
233        $list = new TopLossesList();
234        $list->addVictimAlliance($alliance);
235        $list->setPodsNoobShips(false);
236        $list->setMonth(date("m"));
237        $list->setYear(date("Y"));
238        $table = new TopPilotTable($list, "Losses");
239        $html .= $table->generate();
240
241        $html .= "</td><td valign=top width=400>";
242        $html .= "<div class=block-header>All time</div>";
243
244        $list = new TopLossesList();
245        $list->addVictimAlliance($alliance);
246        $list->setPodsNoobShips(false);
247        $table = new TopPilotTable($list, "Losses");
248        $html .= $table->generate();
249
250        $html .= "</td></tr></table>";
251
252        break;
253    case "ships_weapons":
254        $html .= "<div class=block-header2>Ships & weapons used</div>";
255
256        $html .= "<table class=kb-subtable><tr><td valign=top width=400>";
257        $shiplist = new TopShipList();
258        $shiplist->addInvolvedAlliance($alliance);
259        $shiplisttable = new TopShipListTable($shiplist);
260        $html .= $shiplisttable->generate();
261        $html .= "</td><td valign=top align=right width=400>";
262
263        $weaponlist = new TopWeaponList();
264        $weaponlist->addInvolvedAlliance($alliance);
265        $weaponlisttable = new TopWeaponListTable($weaponlist);
266        $html .= $weaponlisttable->generate();
267        $html .= "</td></tr></table>";
268
269        break;
270}
271
272$menubox = new MenuBox();
273$menubox->addCaption("Kills & losses");
274$menubox->addOption("Recent activity", "?a=alliance_detail&all_id=" . $alliance->getID());
275$menubox->addOption("Kills", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=kills");
276$menubox->addOption("Losses", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=losses");
277$menubox->addCaption("Corp statistics");
278$menubox->addOption("Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_kills");
279$menubox->addOption("Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=corp_losses");
280
281$menubox->addCaption("Pilot statistics");
282$menubox->addOption("Top killers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_kills");
283
284$killboard = $page->killboard_;
285$config = $killboard->getConfig();
286if ($config->getKillPoints())
287    $menubox->addOption("Top scorers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_scores");
288$menubox->addOption("Top losers", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=pilot_losses");
289$menubox->addCaption("Global statistics");
290$menubox->addOption("Ships & weapons", "?a=alliance_detail&all_id=" . $alliance->getID() . "&view=ships_weapons");
291$page->addContext($menubox->generate());
292
293$page->setContent($html);
294$page->generate();
295
296?>
Note: See TracBrowser for help on using the browser.