1 | <?php |
---|
2 | require_once("class.kill.php"); |
---|
3 | require_once("class.page.php"); |
---|
4 | require_once("class.pilot.php"); |
---|
5 | require_once("class.corp.php"); |
---|
6 | require_once("class.box.php"); |
---|
7 | require_once("class.alliance.php"); |
---|
8 | require_once("globals.php"); |
---|
9 | global $config, $smarty; |
---|
10 | |
---|
11 | |
---|
12 | $page = new Page("Kill details"); |
---|
13 | |
---|
14 | if ($config->getConfig('item_values')) |
---|
15 | { |
---|
16 | $smarty->assign('item_values',"true"); |
---|
17 | if($page->isAdmin()) { |
---|
18 | $smarty->assign('admin',"true"); |
---|
19 | if (isset($_POST['submit'])) { |
---|
20 | // Send new value for item to the database |
---|
21 | $IID = $_POST['IID']; |
---|
22 | $Val = $_POST[$IID]; |
---|
23 | //echo "UPDATE kb3_items SET itm_value ='" . $Val . "' WHERE itm_id='" . $IID . "'"; |
---|
24 | $qry = new DBQuery(); |
---|
25 | $qry->execute("UPDATE kb3_items SET itm_value ='" . $Val . "' WHERE itm_id='" . $IID . "'") or die($qry->getErrorMsg()); |
---|
26 | |
---|
27 | } |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | if (!$kll_id = intval($_GET['kll_id'])) |
---|
34 | { |
---|
35 | $html = "No kill id spezified."; |
---|
36 | $page->setContent($html); |
---|
37 | $page->generate($html); |
---|
38 | exit; |
---|
39 | } |
---|
40 | $kill = new Kill($kll_id); |
---|
41 | if (!$kill->exists()) |
---|
42 | { |
---|
43 | $html = "That kill doesn't exist."; |
---|
44 | $page->setContent($html); |
---|
45 | $page->generate($html); |
---|
46 | exit; |
---|
47 | } |
---|
48 | |
---|
49 | // victim $smarty->assign('',); |
---|
50 | $smarty->assign('VictimPortrait',$kill->getVictimPortrait(64)); |
---|
51 | $smarty->assign('VictimURL',"?a=pilot_detail&plt_id=".$kill->getVictimID()); |
---|
52 | $smarty->assign('VictimName',$kill->getVictimName()); |
---|
53 | $smarty->assign('VictimCorpURL',"?a=corp_detail&crp_id=".$kill->getVictimCorpID()); |
---|
54 | $smarty->assign('VictimCorpName',$kill->getVictimCorpName()); |
---|
55 | $smarty->assign('VictimAllianceURL',"?a=alliance_detail&all_id=".$kill->getVictimAllianceID()); |
---|
56 | $smarty->assign('VictimAllianceName',$kill->getVictimAllianceName()); |
---|
57 | |
---|
58 | |
---|
59 | // involved |
---|
60 | $i=1; |
---|
61 | $involved = array(); |
---|
62 | foreach ($kill->involvedparties_ as $inv) |
---|
63 | { |
---|
64 | $pilot = new Pilot($inv->getPilotID()); |
---|
65 | $corp = new Corporation($inv->getCorpID()); |
---|
66 | $alliance = new Alliance($inv->getAllianceID()); |
---|
67 | $ship = $inv->getShip(); |
---|
68 | $weapon = $inv->getWeapon(); |
---|
69 | |
---|
70 | $involved[$i]['shipImage'] = $ship->getImage(64); |
---|
71 | $involved[$i]['PilotURL'] = "?a=pilot_detail&plt_id=".$pilot->getID(); |
---|
72 | $involved[$i]['PilotName'] = $pilot->getName(); |
---|
73 | $involved[$i]['CorpURL'] = "?a=corp_detail&crp_id=".$corp->getID(); |
---|
74 | $involved[$i]['CorpName'] = $corp->getName(); |
---|
75 | $involved[$i]['AlliURL'] = "?a=alliance_detail&all_id=".$alliance->getID(); |
---|
76 | $involved[$i]['AlliName'] = $alliance->getName(); |
---|
77 | $involved[$i]['ShipName'] = $ship->getName(); |
---|
78 | |
---|
79 | if ($pilot->getID() == $kill->getFBPilotID()) |
---|
80 | { |
---|
81 | $involved[$i]['FB'] = "true"; |
---|
82 | } |
---|
83 | else |
---|
84 | { |
---|
85 | $involved[$i]['FB'] = "false"; |
---|
86 | } |
---|
87 | |
---|
88 | if ($corp->isNPCCorp()) |
---|
89 | { |
---|
90 | $involved[$i]['portrait'] = $corp->getPortraitURL(64); |
---|
91 | } |
---|
92 | else |
---|
93 | { |
---|
94 | $involved[$i]['portrait'] = $pilot->getPortraitURL(64); |
---|
95 | } |
---|
96 | |
---|
97 | if ($weapon->getName() != "Unknown" && $weapon->getName() != $ship->getName()) |
---|
98 | $involved[$i]['weaponName'] = $weapon->getName(); |
---|
99 | else |
---|
100 | $involved[$i]['weaponName'] = "Unknown"; |
---|
101 | ++$i; |
---|
102 | } |
---|
103 | $smarty->assign('involved',$involved); |
---|
104 | |
---|
105 | if ($config->getConfig('comments')) |
---|
106 | { |
---|
107 | include('comments.php'); |
---|
108 | $smarty->assign('comments',"true"); |
---|
109 | } |
---|
110 | |
---|
111 | |
---|
112 | // ship, ship details |
---|
113 | $ship = $kill->getVictimShip(); |
---|
114 | $shipclass = $ship->getClass(); |
---|
115 | $system = $kill->getSystem(); |
---|
116 | |
---|
117 | $smarty->assign('VictimShip',$kill->getVictimShip()); |
---|
118 | $smarty->assign('ShipClass',$ship->getClass()); |
---|
119 | $smarty->assign('ShipImage',$ship->getImage(64)); |
---|
120 | $smarty->assign('ShipName',$ship->getName()); |
---|
121 | $smarty->assign('ClassName',$shipclass->getName()); |
---|
122 | $smarty->assign('System',$system->getName()); |
---|
123 | $smarty->assign('SystemURL',"?a=system_detail&sys_id=".$system->getID()); |
---|
124 | $smarty->assign('SystemSecurity',$system->getSecurity(true)); |
---|
125 | $smarty->assign('TimeStamp',$kill->getTimeStamp()); |
---|
126 | $smarty->assign('VictimShipImg',$ship->getImage(64)); |
---|
127 | |
---|
128 | |
---|
129 | // ship fitting |
---|
130 | if (count($kill->destroyeditems_) > 0) |
---|
131 | { |
---|
132 | $cargo = array(); |
---|
133 | $drone = array(); |
---|
134 | $high_slot = array(); |
---|
135 | $mid_slot = array(); |
---|
136 | $low_slot = array(); |
---|
137 | |
---|
138 | foreach($kill->destroyeditems_ as $destroyed) |
---|
139 | { |
---|
140 | $item = $destroyed->getItem(); |
---|
141 | if ($config->getConfig('item_values')) |
---|
142 | { |
---|
143 | |
---|
144 | $value = $destroyed->getValue(); |
---|
145 | $value_single = $value; |
---|
146 | if ($value > 0) |
---|
147 | { |
---|
148 | $value = $destroyed->getValue() * $destroyed->getQuantity(); |
---|
149 | $TotalValue = $TotalValue + $value; |
---|
150 | |
---|
151 | // Value Manipulation for prettyness. |
---|
152 | |
---|
153 | if (strlen($value) >1) { // 1000's ? |
---|
154 | $Formatted = number_format($value,2); |
---|
155 | $Formatted = $Formatted . " isk"; |
---|
156 | } |
---|
157 | |
---|
158 | if (strlen($value) >3) { // 1000's ? |
---|
159 | $Formatted = round($value / 1000,2); |
---|
160 | |
---|
161 | $Formatted = number_format($Formatted,2); |
---|
162 | $Formatted = $Formatted . " K"; |
---|
163 | } |
---|
164 | |
---|
165 | if (strlen($value) >6) { // Is this value in the millions? |
---|
166 | $Formatted = round($value / 1000000,2); |
---|
167 | $Formatted = number_format($Formatted,2); |
---|
168 | $Formatted = $Formatted . " M"; |
---|
169 | } |
---|
170 | } |
---|
171 | else |
---|
172 | { |
---|
173 | $value = 0; |
---|
174 | $Formatted = "0 isk"; |
---|
175 | } |
---|
176 | } |
---|
177 | $dest_array[$destroyed->getLocationID()][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $destroyed->getQuantity(), 'Value'=>$Formatted,'single_unit'=>$value_single,'itemID'=>$item->getID() ); |
---|
178 | |
---|
179 | } |
---|
180 | |
---|
181 | } |
---|
182 | |
---|
183 | /* |
---|
184 | echo count($mid_slot); |
---|
185 | print_r($low_slot); |
---|
186 | print_r($dest_array['1']);*/ |
---|
187 | |
---|
188 | |
---|
189 | if ($TotalValue > 0) |
---|
190 | { |
---|
191 | $Formatted = number_format($TotalValue,2); |
---|
192 | } |
---|
193 | //Get Ship Value |
---|
194 | $ShipValue = $ship->getPrice(); |
---|
195 | |
---|
196 | $TotalLoss = number_format($TotalValue + $ShipValue,2); |
---|
197 | $ShipValue = number_format($ShipValue,2); |
---|
198 | |
---|
199 | $smarty->assign('high_slot',$dest_array['1']); |
---|
200 | $smarty->assign('mid_slot',$dest_array['2']); |
---|
201 | $smarty->assign('low_slot',$dest_array['3']); |
---|
202 | $smarty->assign('cargo',$dest_array['4']); |
---|
203 | $smarty->assign('drone',$dest_array['6']); |
---|
204 | $smarty->assign('ItemValue',$Formatted); |
---|
205 | $smarty->assign('ShipValue',$ShipValue); |
---|
206 | $smarty->assign('TotalLoss',$TotalLoss); |
---|
207 | |
---|
208 | |
---|
209 | $menubox = new box("Menu"); |
---|
210 | $menubox->setIcon("menu-item.gif"); |
---|
211 | $menubox->addOption("caption","View"); |
---|
212 | $menubox->addOption("link","Killmail", "javascript:openWindow( '?a=kill_mail&kll_id=".$kill->getID()."', null, 355, 430, '' );"); |
---|
213 | if ($kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1) |
---|
214 | { |
---|
215 | $menubox->addOption("link","Related kills (".$kill->relatedKillCount()."/".$kill->relatedLossCount().")", "?a=kill_related&kll_id=".$kill->getID()); |
---|
216 | } |
---|
217 | if ($page->isAdmin()) |
---|
218 | { |
---|
219 | $menubox->addOption("caption","Admin"); |
---|
220 | $menubox->addOption("link","Delete", "javascript:openWindow('?a=kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); |
---|
221 | } |
---|
222 | $page->addContext($menubox->generate()); |
---|
223 | |
---|
224 | |
---|
225 | if ($config->getKillPoints()) |
---|
226 | { |
---|
227 | $scorebox = new Box("Points"); |
---|
228 | $scorebox->addOption("points",$kill->getKillPoints()); |
---|
229 | $page->addContext($scorebox->generate()); |
---|
230 | } |
---|
231 | |
---|
232 | |
---|
233 | $mapbox = new Box("Map"); |
---|
234 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=map&size=145"); |
---|
235 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=region&size=145"); |
---|
236 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=cons&size=145"); |
---|
237 | $page->addContext($mapbox->generate()); |
---|
238 | |
---|
239 | |
---|
240 | $html = $smarty->fetch('kill_detail.tpl'); |
---|
241 | $page->setContent($html); |
---|
242 | $page->generate(); |
---|
243 | ?> |
---|