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